Access Database not updating with OleDb

Here's my update method

public void Update(string query, List<OleDbParameter> parameters)
            OleDbCommand cmd = new OleDbCommand();
            OleDbTransaction transaction = null;
            query = "UPDATE " + query;

            foreach (OleDbParameter parameter in parameters)


            transaction = _connection.BeginTransaction();
            cmd.Connection = _connection;
            cmd.CommandText = query;
            cmd.Transaction = transaction;
            int linesUpdated = cmd.ExecuteNonQuery();



Full class

 public class DBAdapter
        private OleDbConnection _connection;

        private void _Connect()
            this._connection = new OleDbConnection();
            _connection.ConnectionString = ConfigurationManager.ConnectionStrings[1].ConnectionString;

        private void _Disconnect()

        public void Update(string query, List<OleDbParameter> parameters)


When I launch my application, this works well :

  1. I select user by id
  2. I store data in an object, I display the user's name. Then I modify user's name property.
  3. I save it to database
  4. I select again the same user
  5. I display again the user's name : value displayed was changed, so the update method works.

But when I close my app and launch it again, It displays me the old value, then the new value, like I didn't make any changes. What's wrong with my code ?

EDIT : I found the problem. My .mdb file is located in //Assets/Database/, when I run my app, the file is copied in bin/Debug/assets/Databases/. How should I update the original file ?

EDIT (2) : Solved! Can I commit changes to actual database while debugging C# in Visual Studio?


just you can change path of connection string to update you'r original file but i dont recommend you i recommend you to right click on original file in solution explorer and select properties and set "Copy to out put directory" to "Copy if newer"

Need Your Help

Confused about resources in a .NET project

c# visual-studio-2008 .net-3.5 resources

I am trying to remove a massive amount of cruft from a .NET 3.5, VS2008 project and I am somewhat confused as to what gets compiled into an EXE and what isn't.

Free jqGrid - How to restore filter bar operators

jquery jqgrid free-jqgrid

Suppose I have a filer toolbar filled up with the actual values and operators (ne, lt, etc').