Results 1 to 4 of 4

Thread: delete row from datatable

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2008
    Posts
    42

    delete row from datatable

    I can add rows and it automatically updates, work fine.
    but when i try to delete a row, some can be delete some cant. but after all when I reload the list everything is unchanged..

    Code:
     Dim response = MsgBox("Are you sure?", 4 Or 32, "")
                If response = MsgBoxResult.Yes Then
                    rownum = SCD_allowedDataGrid.CurrentRowIndex
                    SCD.SCD_allowed.Rows(rownum).Delete()
                    Me.SCD_allowedDataGrid.Update()
                  
                End If
    then i try this: i got an error " Update requires a valid DeleteCommand when passed DataRow collection with deleted rows."
    ok...i think i need a deletecommand.
    DELETE FROM [SCD allowed]
    WHERE ???? <<< what do i put here if i want to delete a selected row?

    Code:
     Dim response = MsgBox("Are you sure?", 4 Or 32, "")
                If response = MsgBoxResult.Yes Then
                    rownum = SCD_allowedDataGrid.CurrentRowIndex
                    SCD.SCD_allowed.Rows(rownum).Delete()
                   Me.SCD_allowedTableAdapter.Update(SCD.SCD_allowed)
                  
                End If
    Last edited by husky_doggy; Mar 2nd, 2009 at 09:22 AM.

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