Problem insert into access DB
Hi
I'm trying to insert into access DB this data using this code
is any one can explain what is wrong with this code ????
the code :
---------------------------------------------------------------------------------------
OleDbConnection connection = new OleDbConnection(strDBConn);
OleDbTransaction transaction;
String sql = "INSERT INTO TblProjects (field1, field2, field3, field4, field5)" +
" VALUES ('" + txtbx_ProjectName.Text +
"','" + ddlst_SystemsType.SelectedItem.Text +
"','" + ddlst_Versions.SelectedItem.Text +
"','" + ddlst_Tester.SelectedItem.Text +
"','" + ddlst_ProjectManager.SelectedItem.Text + "');";
connection.Open();
transaction = connection.BeginTransaction();
st = sql;
OleDbCommand commmand = new OleDbCommand(sql, connection);
commmand.CommandType = CommandType.Text;
commmand.Transaction = transaction;
commmand.ExecuteNonQuery();
transaction.Commit();
connection.Close();
Response.Redirect("aspPage.aspx");
---------------------------------------------------------------------------------------
the exception is :
Operation must use an updateable query.
---------------------------------------------------------------------------------------
the SQL is:
INSERT INTO TblProjects (field1, field2, field3, field4, field5)
VALUES ('aaa','bbb','ccc','ddd','eee');

AdministratorRank #675 · 3.6K reputationPosted Mar 7, 2003, 7:03 PM EST
AdministratorRank #675 · 3.6K reputationPosted Mar 9, 2003, 12:05 PM EST
AdministratorRank #675 · 3.6K reputationPosted Mar 18, 2003, 1:05 AM EST
Tanvir HudaRank #4,089 · 366 reputationPosted Jan 4, 2004, 7:16 PM EST
georgeskaddoum6 reputationPosted Jan 21, 2004, 4:43 AM EST
suhil.srinivas8 reputationPosted Jan 22, 2004, 7:13 AM EST
crend_king24 reputationPosted Feb 9, 2004, 4:46 AM EST
crend_king24 reputationPosted Feb 9, 2004, 4:52 AM EST
crend_king24 reputationPosted Feb 9, 2004, 5:29 AM EST
crend_king24 reputationPosted Feb 11, 2004, 3:28 AM EST