L
LC
Ok...I give up.
I am coding my own ole data adapter. I have a table called "Savings"
which I am updating via a datagrid. I have the following code to set
up my update command:
-----------------------
// Setup Savings
//Update
uCmd =
new OleDbCommand("UPDATE Savings SET "
+ "[Description]=@Description,"
+ "Amount=@Amount "
+ "WHERE (TransDate=@TransDate)");
uCmd.Parameters.Add("@Description",
System.Data.OleDb.OleDbType.VarChar, 100, "Description");
uCmd.Parameters.Add("@Amount", System.Data.OleDb.OleDbType.Currency,
4, "Amount");
uCmd.Parameters.Add("@TransDate", System.Data.OleDb.OleDbType.Date,
0, "@TransDate");
oleDbDataAdapter1.UpdateCommand = uCmd;
------------------------------------------
If I update a row in the datagrid and hit Update the database will be
updated but every row in the database table is updated. Doesn't look
like the system is using my where clause. I have 2 rows in the table
and transdate is the primary key. If I have 7/01/05 and 7/02/05 rows
and I update only the 7/01/05 row, the change is made to both rows.
Can someone please point in the correct direction here?
Thanks
I am coding my own ole data adapter. I have a table called "Savings"
which I am updating via a datagrid. I have the following code to set
up my update command:
-----------------------
// Setup Savings
//Update
uCmd =
new OleDbCommand("UPDATE Savings SET "
+ "[Description]=@Description,"
+ "Amount=@Amount "
+ "WHERE (TransDate=@TransDate)");
uCmd.Parameters.Add("@Description",
System.Data.OleDb.OleDbType.VarChar, 100, "Description");
uCmd.Parameters.Add("@Amount", System.Data.OleDb.OleDbType.Currency,
4, "Amount");
uCmd.Parameters.Add("@TransDate", System.Data.OleDb.OleDbType.Date,
0, "@TransDate");
oleDbDataAdapter1.UpdateCommand = uCmd;
------------------------------------------
If I update a row in the datagrid and hit Update the database will be
updated but every row in the database table is updated. Doesn't look
like the system is using my where clause. I have 2 rows in the table
and transdate is the primary key. If I have 7/01/05 and 7/02/05 rows
and I update only the 7/01/05 row, the change is made to both rows.
Can someone please point in the correct direction here?
Thanks