i m inserting values in access database it displays message value is inserted but value is not ptresent in database.
I m using following code
OleDbConnection cnn = new OleDbConnection ();
cnn.ConnectionS tring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=|DataDir ectory|\\medica l.mdb";
cnn.Open();
string str = "insert into medicin(medicin ename,companyna me,quantity,pri ce,mfgdate,expi rydate,ordering date,deliveryda te) values('" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1 .Value + "','" + dateTimePicker2 .Value + "','" + dateTimePicker3 .Value + "','" + dateTimePicker4 .Value + "')";
OleDbCommand cmd = new OleDbCommand(st r, cnn);
OleDbDataAdapte r da = new OleDbDataAdapte r(str, cnn);
DataSet ds = new DataSet();
da.Fill(ds, str);
//showDataInGrid( );
MessageBox.Show ("Record saved!");
I m using following code
OleDbConnection cnn = new OleDbConnection ();
cnn.ConnectionS tring = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=|DataDir ectory|\\medica l.mdb";
cnn.Open();
string str = "insert into medicin(medicin ename,companyna me,quantity,pri ce,mfgdate,expi rydate,ordering date,deliveryda te) values('" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1 .Value + "','" + dateTimePicker2 .Value + "','" + dateTimePicker3 .Value + "','" + dateTimePicker4 .Value + "')";
OleDbCommand cmd = new OleDbCommand(st r, cnn);
OleDbDataAdapte r da = new OleDbDataAdapte r(str, cnn);
DataSet ds = new DataSet();
da.Fill(ds, str);
//showDataInGrid( );
MessageBox.Show ("Record saved!");
Comment