I have .mdb database, and code like this:
using (OleDbConnection connection = new OleDbConnection(myConnectionString))
{
using (OleDbCommand cmd = connection.CreateCommand())
{
cmd.CommandText = "UPDATE myTab SET col2 = @val1 WHERE col1 = @val2";
cmd.Parameters.AddWithValue("@val1", 0);
cmd.Parameters.AddWithValue("@val2", -1);
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
}
I get data from db, change it in my gui programm, then save it in db. Changes saves, but not in db (I don’t know where), so when I run program, change data, close program, then again run – changes remain, but when I open db (not in programm), there are no changes saved, and again run – all changes disappear.
PS: when I commit changes, then run program several times, all changes disappear too, after (3-4 runs)
When we we add
.mdbin project root in VS ,when change structure ,VS default delete.mdbfile in debug folder and replace new file; now you can change this defult :1- right click
.mdbfile and select option2- set
Copy To Output DirectorytoDo Not Copy