Delete from DataGrid with DataAdapter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • axas
    New Member
    • Jul 2006
    • 32

    Delete from DataGrid with DataAdapter

    I am writing this code:

    myDataSet.Table s["WORKER"].Rows[index].Delete();
    myDataAdapter.U pdate(myDataSet , "WORKER");
    myDataSet.Table s["WORKER"].AcceptChanges( );

    and I have this error:

    "Update requires a valid DeleteCommand when passed DataRow collection with deleted rows."

    What can I do???
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    Check your table whether you defined the primary key.

    When creating the DataAdapter through wizard, it has to pass all the 4 commands (A Green Check). If its not it will fail.

    Comment

    • radcaesar
      Recognized Expert Contributor
      • Sep 2006
      • 759

      #3
      Check your table whether you defined the primary key.

      When creating the DataAdapter through wizard, it has to pass all the 4 commands (A Green Check). If its not it will fail.

      Another one question, Is it VS 2005 ?

      Comment

      • radcaesar
        Recognized Expert Contributor
        • Sep 2006
        • 759

        #4
        If u still not clear,
        Here we go....

        http://forum.jamesfoxa ll.com/showthread.php? t=92

        Comment

        Working...