public void InsertCustomer() { String q = "insert into Customers(FirstName,LastName,ContactNumber,Address,Gender,DateOfBirth,RoomType,Rooms) values ('" + FirstName + "','" + LastName + "','" + ContactNo + "','" + Address + "','" + Gender + "','" + this.DateOfBirth + "','" + RoomType + "','" + Room + "')"; try { using (DBConect db = new DBConect()) { bool ok = db.insert(q); if (ok) { MessageBox.Show("User inserted successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("User insertion failed", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
// public String DateOfBirth { get; set; } // RoomType { get; set; } // public int Room { get; set; } public void InsertCustomer() { String q = "insert into customers(FirstName,LastName,NIC,ContactNumber,Address,Gender,checkin,checkout,adults,children,DeluxeRoom,SuiteRoom,StandardRoom) values ('" + FirstName + "','" + LastName + "','" + NIC + "','" + ContactNo + "','" + Address + "','" + Gender + "','" + this.checkin + "','" + this.checkout + "','" + adults + "','" + children + "','" + DeluxeRoom + "','" + SuiteRoom + "','" + StandardRoom + "')"; try { using (DBConect db = new DBConect()) { bool ok = db.insert(q); if (ok) { MessageBox.Show("User inserted successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("User insertion failed", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
public void InsertRooms() { //int ContactId = txtUn; //String FirstName = txtFn; //String LastName = txtLn; //String ContactNo = txtCn; //String Address = txtAd; //String Gender = txtGn; //String DateOfBirth = txtDob; //String RoomType = txtRt; //String Room = txtRo; String q = "insert into Rooms(CheckIn,CheckOut,Roomtypess,RoomNo) values ('" + this.CheckIn + "','" + this.CheckOut + "','" + Roomtypess + "','" + RoomNo + "')"; try { using (DBConect db = new DBConect()) { bool ok = db.insert(q); /* if (ok) * { * * MessageBox.Show("Room inserted successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); * } * else * { * MessageBox.Show("Room insertion failed", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); * }*/ //SqlCommand cmd = new SqlCommand(q, db.con); //cmd.ExecuteNonQuery(); //MessageBox.Show("User inserted successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); //clearTexts(); } } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
private void addUser() { String userName = txtUn.Text; String password = txtPw.Text; String q = "insert into Users(userName,password) values ('" + userName + "','" + password + "')"; try { using (DBConect db = new DBConect()) { db.insert(q); //SqlCommand cmd = new SqlCommand(q, db.con); //cmd.ExecuteNonQuery(); //MessageBox.Show("User inserted successfully", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information); //clearTexts(); } } catch (Exception e) { Console.WriteLine(e.StackTrace); } }