uiu

uiu

  • NA
  • 1
  • 0

Connecting to a database with c#

Dec 1 2009 1:36 PM

Hi guys im doing a wee project at the minute i need to add a record to  a database from a windows form on event button click (coded in c#) ive got code sorted that doesnt error however it doesnt save the records that i enter either i will post the code any help would be greatly appreciated
 
 

 
private void confirmbut_Click(object sender, EventArgs e)
{
OleDbConnection Conn = new OleDbConnection (
"Provider=Microsoft.ACE.OLEDB.12.0; Data Source= H:\\VRUSLTD\\VRUS.accdb");

OleDbCommand Cmd = new OleDbCommand
(
"INSERT INTO Rental_Details(RentalID,Reg_No,CustID,StaffMember,PickUpDate,PickUpTime,Due_Back,DaysRental) SELECT '" +
rentIDtb.Text +
"','" + vehIDtb.Text + "','" + custIDtb + "','" + empIDtb + "','" + pickuptb + "','" + picktimetb + "','" + returntb + "','" + daystb + "';", Conn);
}

Answers (1)