Results 1 to 5 of 5

Thread: delete row in dataset by having the key

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    delete row in dataset by having the key

    ill appreciate any help - as you can see im little bit desperate!
    so ill try to clarify my self as better as i can
    i have
    *********dataset*************
    dscomapanies1


    ************table************
    dscompanies1.T_ConnectionDetails

    ************1st col of the table -> primary key*********
    the name of the primary key col is
    conndetails_Code

    so.....
    i have a key as integer - let assume 25. i need to know how to find it in the table and to delete it
    any help will be more then appreciated

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    Try something like this....

    Code:
    Dim dr() As DataRow = dscompanies1.T_ConnectionDetails.Select("conndetails_Code = 25")
    Dim r As DataRow
    For Each r In dr
        dscompanies1.T_ConnectionDetails.Rows.Remove(r)
    Next

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    deleteing row from dataset

    Dim dr() As DataRow = dscompanies1.T_ConnectionDetails.Select("conndetails_Code = 25")
    Dim r As DataRow
    For Each r In dr
    dscompanies1.T_ConnectionDetails.Rows.Remove(r)
    Next


    i think ir deletes the dr array no? not the approprate row in the dataset - as long as i tested the code.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    It deletes the dr array yes, and that array according to the select methos should contain the rows (probably just 1) with the conndetails_Code equal to 25. Is that not what you intended?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175
    hi there athely
    i hope lots of people should be like you - (willing to help)
    i ment to delete a row from the dataset table not to create empty row and to init it with the row which refers to my key and then to delete the row i mention that i want to find the row by ******* key that i have in the dataset table abd then to delete it!!! directly in the dataset!

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