Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Updates to MS Access not sticking...
 

Updates to MS Access not sticking...

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
David The Lost  Monday, September 08, 2008 3:27 PM
Hi David,

this is a GAX specific forum, please post your question in the proper C# forum.
http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/threads/

thanks
jose.
Jose Escrich - weblogs.asp.net/jescrich
  • Proposed As Answer byJose Escrich Thursday, October 02, 2008 12:39 PM
  •  
Jose Escrich  Thursday, October 02, 2008 12:22 PM

You can use google to search for other answers

Custom Search

More Threads

• Generate an Entity class from database
• June 2006 CTP and Hands On Lab
• Install of February 2008 GAX Fails
• Failed install for Feb Release of GAT
• Trying to add a new class to the References folder...
• How to add template menu item to custom solution
• Introduction to GAT
• will GATGAX work in VS 2008 beta2
• The file cannot be opened with the selected editor
• Another uninstall problem of GAT/GAE