Hello,
I have been writing code for some time the various versions of Visual Studio in C#, but recently moved up to Vista SP1 as a development environment with the whole new office suite.
My problem is that updates that i make to an access database don't stick. If I run my code, the update *seems* to be successful, even to the point of closing and re-retrieving the data from the database. I can even end the program and re-run it, and the updates appear to be there. But if i close the program, open Access, and inspect the table, the values are un-updated. IfI then rerun my program, it shows the old values.
Here is my code snippet:
public void InsertRow(string connectionString, string insertSQL)
{
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
// The insertSQL string contains a SQL statement that
// inserts a new row in the source table.
OleDbCommand command = new OleDbCommand(insertSQL);
// Set the Connection to the new OleDbConnection.
command.Connection = connection;
// Open the connection and execute the insert command.
try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// The connection is automatically closed when the
// code exits the using block.
}
}
This should look familiar because i copied it right out of the hep documentation. :)MySQL statement just happens to be an update rather than an insert. Any idea why the update would appear to take, but... wear off? I am assuming that it is something to do with a cache not being written back, but am lost...
David
David