Hi All,

I am using visual studio 2005 and Access 2007.
I want to update a table in access 2007 using C#.net.
I have written the following code but it doesn't seem to work and neither does it throw any error.

OleDbCommand updateTransactionCost = new OleDbCommand();
                updateTransactionCost.Connection = Module1.oledbcon;
                updateTransactionCost.CommandText = "Update Transactions set Total_Transaction_Cost = @amount,Transaction_Printed = @Print where Transaction_ID = @Transaction_ID";

                updateTransactionCost.Parameters.Add("@amount", OleDbType.VarChar);
                updateTransactionCost.Parameters.Add("@Transaction_ID", OleDbType.VarChar);
                updateTransactionCost.Parameters.Add("@Print", OleDbType.Boolean);

                updateTransactionCost.Parameters["@amount"].Value = totalTransactionAmount;
                updateTransactionCost.Parameters["@Transaction_ID"].Value = Transaction_ID;
                updateTransactionCost.Parameters["@Print"].Value = Print;

                updateTransactionCost.ExecuteNonQuery();

Probably it doesn't have privileges or something else.

Hi all,

I also figured out that certain features are disabled in access by default.
Can this be enabled using C# which will help me run update statements.

ok i figured out a way of enabling al the features of access 2007 and still the code is not working.

No response. :sad:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.