-
Sep 17th, 2021, 11:18 AM
#1
Thread Starter
Junior Member
help! DataRow update error
I have a data table, PK, not on the field, I have modified the DataRow in a record, and then use the following code updates to the database, but there is an error
Dim cmdBuilder As New System.Data.SQLite.SQLiteCommandBuilder(salda_xmname)
salda_xmname.Update(ds, "xmname") <---Violation of concurrency: UpdateCommand article expected 1 the record of zero
ds.Tables("xmname").AcceptChanges()
but, if a new record and modify the content, implement the code there is no mistake
why?
-
Sep 17th, 2021, 12:41 PM
#2
Re: help! DataRow update error
Put your between code tags, just click the "#" on the toolbar.
Code:
Dim cmdBuilder As New System.Data.SQLite.SQLiteCommandBuilder(salda_xmname)
salda_xmname.Update(ds, "xmname") <---Violation of concurrency: UpdateCommand article expected 1 the record of zero
ds.Tables("xmname").AcceptChanges()
I have a data table, PK, not on the field
Not sure what that means. Are you saying there is NO primarykey? If so, you can not use a commandbuilder.
Also, there is no reason to use "AcceptChanges". The "Update" method will do that. Plus if you call it and then make additional changes, you will get a concurrency error when you call the dataadapter Update method.
-
Sep 18th, 2021, 10:34 AM
#3
Thread Starter
Junior Member
Re: help! DataRow update error
Originally Posted by wes4dbt
Put your between code tags, just click the "#" on the toolbar.
Code:
Dim cmdBuilder As New System.Data.SQLite.SQLiteCommandBuilder(salda_xmname)
salda_xmname.Update(ds, "xmname") <---Violation of concurrency: UpdateCommand article expected 1 the record of zero
ds.Tables("xmname").AcceptChanges()
Not sure what that means. Are you saying there is NO primarykey? If so, you can not use a commandbuilder.
Also, there is no reason to use "AcceptChanges". The "Update" method will do that. Plus if you call it and then make additional changes, you will get a concurrency error when you call the dataadapter Update method.
sorry! I there is primary key,but no AUTO_INCREMENT
-
Sep 18th, 2021, 12:59 PM
#4
Re: help! DataRow update error
What columns does the table have and what values are you providing?
-
Sep 21st, 2021, 03:09 AM
#5
Thread Starter
Junior Member
Re: help! DataRow update error
Originally Posted by jmcilhinney
What columns does the table have and what values are you providing?
After efforts to test, I updated to vs2012, delete the field(data type=datetime timestamp,default value = datetime (' now ', 'a localtime)) , The problem is resolved.But I'm not sure whether vs version of the problem.
Thank you very much!
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
|