i m inserting values in access database but value is not ptresent in database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arvindmishra
    New Member
    • Mar 2010
    • 1

    i m inserting values in access database but value is not ptresent in database

    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!");
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    You have to actually run the command!

    Comment

    Working...