Results 1 to 5 of 5

Thread: help! DataRow update error

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2021
    Posts
    19

    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?

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    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.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2021
    Posts
    19

    Re: help! DataRow update error

    Quote Originally Posted by wes4dbt View Post
    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

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: help! DataRow update error

    What columns does the table have and what values are you providing?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2021
    Posts
    19

    Re: help! DataRow update error

    Quote Originally Posted by jmcilhinney View Post
    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
  •  



Click Here to Expand Forum to Full Width