|
-
Jun 15th, 2012, 05:33 AM
#1
Thread Starter
New Member
tableadapter.update
Hello Guru's
Environment = VB.NET 2005 & Pervasive SQL 9.5 ADO.NET
Can someone please try to explain this behavour . . . .
In a simplified example, I have single database table (customers) with the columns "customer_code_PK" and "customer_name"
This table is presented in VB.NET 2005 as a single form datagrid (bindingsource/dataset).
In this example, the database table is populated with the following data
customer_code_PK customer_name
SHELL Shell Oil
BP British Petrolium
MOB Mobile
In very simplified terms, code does the following;
sub on form load
fill dataset with database records (select * from customers)
call generate_custom_updateinsertdeletecommands (have also tried commandbuilder here)
end load
sub save_button
bindingsource endedit
tableadapter.update
end save
The datagridview loads the records correctly.
Here is the sequence of operations that produces the bizzar behaviour.
In the editable datagrid;
1. remove the row with PK = MOB -> save_button -> Database correctly updates
2. add a new row with PK = KFC -> save_button -> Database correctly updates
3. remove row with PK = SHELL -> save_button -> Database exception occurs
On this last command, the row SHELL is INSERTED!!, not removed.
However, If I change ths save_button routine to this
save_button
call generate_custom_updateinsertdeletecommands
bindingsource endedit
tableadapter.update
end save
It works correctly !!!!!!!
Is it correct that you would need to "refresh" the sql update commands after every tableadapter.update ?
Many Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|