datagrid row problem
-
Hi, I have a datagrid which I filled with a dataset. I set the datagrid to read-only.. I wish to delete the selected row of the datagrid. The only problem is how I determine which row is selected in order to deleted from the database??? I have already tried using the currentcell property of the datagrid and getting the row number to determine which row in the data table was selected.. the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? How can I get the correct selected row and match it up with the row in the actual database?? I greatly appreciate all help!!
-
Hi, I have a datagrid which I filled with a dataset. I set the datagrid to read-only.. I wish to delete the selected row of the datagrid. The only problem is how I determine which row is selected in order to deleted from the database??? I have already tried using the currentcell property of the datagrid and getting the row number to determine which row in the data table was selected.. the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? How can I get the correct selected row and match it up with the row in the actual database?? I greatly appreciate all help!!
mdolby wrote: the only problem with that is if I rearrange the elements of the datagrid (order alphabetically) then the currentcel row number does not much to the corresponding row in the database, thus I end up deleting the wrong row?? I don't think this is true. It sort DataSet too so it will delete correct row. how do you delete it.But what ever you do you can perform it like this: Your table must have a KeyField, when you select a row for delete get value of it and delete from databse by using that field. Mazy No sig. available now.