PDA

Click to See Complete Forum and Search --> : delete row in dataset by having the key


ronlahav
Feb 10th, 2003, 02:26 AM
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
:confused: :confused: :confused: :confused: :confused:

Athley
Feb 10th, 2003, 02:39 AM
Try something like this....

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

ronlahav
Feb 10th, 2003, 06:04 AM
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.

Athley
Feb 10th, 2003, 10:27 AM
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?

ronlahav
Feb 10th, 2003, 03:56 PM
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!