Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Configuration;
- using System.Data.SqlClient;
- using System.Data.OleDb;
- namespace PersistentLayer
- {
- public class BookingDA
- {
- string connstringOLEDB = ConfigurationManager.ConnectionStrings["ConnectionStringOLDEDB"].ToString();
- #region Client Booking Related Commands
- public void createClient(string cFirstName, string cLastName, string cEmail, string cMobile, string cAddress)
- {
- int clientID =0;
- OleDbConnection con = new OleDbConnection(connstringOLEDB);
- con.Open();
- try
- {
- //Get the Max IDNO so we can increment by one to create a new client
- string sqlMaxQuery = "Select MAX (clientID) FROM Client";
- OleDbCommand cmd = new OleDbCommand(sqlMaxQuery, con);
- clientID = (int)cmd.ExecuteScalar() + 1;
- //Insert a new client
- string sqlInsertNewClient = "Insert into Client (ClientID, cFirstName, cLastName, cEmail, cMobile, cAddress) VALUES('" + clientID + "', '" + cFirstName + "', '" + cLastName + "', '" + cEmail + "', '" + cMobile + "', '" + cAddress + "' );";
- OleDbCommand command = new OleDbCommand(sqlInsertNewClient, con);
- command.ExecuteNonQuery();
- con.Close();
- }
- catch
- {
- throw new Exception();
- }
- finally
- {
- if (con != null)
- {
- con.Close();
- }
- }
- }
- #endregion
- #region Booking Creation Related Commadns
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement