T
Tom Ashcroft
All
I have the following function
public void AddItem(string cartID, int productID, int quantity)
{
string SQL = "INSERT INTO ShoppingCart ( [CartID], [Quantity],
[ProductID] ) VALUES('" + cartID + "', " + quantity.ToString() + ", " +
productID.ToString() + ")";
try
{
OleDbConnection cn = new OleDbConnection
(ConfigurationSettings.AppSettings["ConnectionString"]);
cn.Open();
OleDbCommand cmd = new OleDbCommand(SQL, cn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
cn.Close();
}
catch(Exception e)
{
string err = e.Message;
}
}
when I try to run this code the Exception message is: -
Operation must use an updateable query
If i paste the resulting SQL into the Access 200 query builder and run it,
it works.
If anyone has any idea how to get around this I'd be eternally grateful
cheers
Tom
I have the following function
public void AddItem(string cartID, int productID, int quantity)
{
string SQL = "INSERT INTO ShoppingCart ( [CartID], [Quantity],
[ProductID] ) VALUES('" + cartID + "', " + quantity.ToString() + ", " +
productID.ToString() + ")";
try
{
OleDbConnection cn = new OleDbConnection
(ConfigurationSettings.AppSettings["ConnectionString"]);
cn.Open();
OleDbCommand cmd = new OleDbCommand(SQL, cn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
cn.Close();
}
catch(Exception e)
{
string err = e.Message;
}
}
when I try to run this code the Exception message is: -
Operation must use an updateable query
If i paste the resulting SQL into the Access 200 query builder and run it,
it works.
If anyone has any idea how to get around this I'd be eternally grateful
cheers
Tom