0

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.

1
Contributor
3
Replies
4
Views
7 Years
Discussion Span
Last Post by babbu
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.