Lets say i have a table containg two fields that are both primary keys,
I then connect to the table using the usual ado net connection process.
connection->sqlcommand->sqladapter->sqlcommandbuilder(using the sqlcommand)->datatable
Then afterwards, i binded it to the Datagridview. I inserted two rows on the datagridview:
Field1 Field2
Value1 Value1Desc
Value2 Value2Desc
I saved it using the sqladapter.update(datatable) command and worked okay.
Next I Deleted the second row:
Field1 Field2
Value1 Value1Desc
Value2 Value2Desc (delete)
Next I Inserted a new row with the same values as the previously deleted row.
Field1 Field2
Value1 Value1Desc
Value2 Value2Desc (New Row Inserted)
then i called the sqladapter.update(datatable) command. what happens next? errrorrrr!!!!!
if anyone knows how to go about the incoming error please tell me how to fix it.
And also can i change the way the update,insert,delete logic is performed on the command builder? lets say i want delete first then update and finally insert?
____________________________
Error 404 ...File not found...!!!!
17-09-2006 at 11:26 AM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Hi,
The error is probably because your cached recordset is inconsistent with the database. Run the update command after the delete to synchronize the recordsets, then run the insert for the new record.
____________________________ multi-tasking - the ability to hang more than one app. at the same time.
17-09-2006 at 12:06 PM
|
Nick2k3 Level: Big Cheese Registered: 23-11-2003 Posts: 23
quote:GeoffS wrote:
Hi,
The error is probably because your cached recordset is inconsistent with the database. Run the update command after the delete to synchronize the recordsets, then run the insert for the new record.
actually i was thinking about that earlier that is why i wrote something like :
"And also can i change the way the update,insert,delete logic is performed on the command builder? lets say i want delete first then update and finally insert?"
If you have any sample code to change how the update, insert,delete is to be performed please post it. (i'm using a commandbuilder)
____________________________
Error 404 ...File not found...!!!!