Hi there, i am deeply troubled as my application runs successfully and adds new entry to the table and i can see that via datagridview.
but as soon as the application closes and i check the database all is gone. there is no entry in the database. kindly see my code.
private void btnUpdateEntry_Click(object sender, EventArgs e)
{
string update_cmd = "INSERT INTO SMO_Table" + "(field1,field2,field3,field4)" + "VALUES( 36,'ali','11:15','17:40')";
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\SMO_DB.mdb");
OleDbCommand aCommand = new OleDbCommand(update_cmd, aConnection);
aConnection.Open();
try
{
aCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
aConnection.Close();
dataGridView1.Enabled = true;
this.sMO_TableTableAdapter.Fill(this.sMO_DBDataSet.SMO_Table);
the above code runs successfully but actually there is no entry in the database. why is this so?
Regards,