public void purchaseProduct(string productname, string challan_no, DateTime challan_date, string bill_no, DateTime bill_date, string Customer,string InvoiceNo)
{
con.Open();
OleDbCommand insert = new OleDbCommand("INSERT INTO [PRODUCT_DETAILS]([PRODUCT_NAME],[CHALLAN_NO],[CHALLAN_DATE],[BILL_NO],[BILL_DATE],[CUST_NAME],[INVOICE_NO])VALUES('"+productname+"','"+challan_no+"',"+challan_date+",'"+bill_no+"',"+ bill_date +",'"+Customer+"','"+InvoiceNo+"')", con);
insert.ExecuteNonQuery();
MessageBox.Show("Your data has been saved.");
}
How to save date in access database from datetime picker in c#. I have passed values in the following manner:
add.purchaseProduct(txtproductname.Text.ToUpper(), txtchallan_no.Text.ToUpper(), txtchallan_date.Value, txtbill_no.Text.ToUpper(), txtbill_date.Value, txtCustomer.Text.ToUpper(), invoiceNo);
I have tried hash in front of date but i ddidnt succed. How to save date in access date/Time datatype format in access.