mcerk Posted December 26, 2004 Posted December 26, 2004 OK. I want to delete rows from DataGrid. I'm doing it like this: Dim RowNumber as integer RowNumber = Me.BindingContext(DataSet.Table1).Position Me.DataSet.Table1.Rows(RowNumber).Delete So, row number 'Me.BindingContext(DataSet.Table1).Position' is marked for deletion (it alsso disapears from DataGrid). The row is deleted, when I update DataSet from DataAdapter. OK, It is all right through this point. But.... If I delete row nr. 8 (Me.BindingContext(DataSet.Table1).Position=8), then row nr. 9 gets number 8. And so on. I can not delete all rows using this method. So my question is. How can I define 'real' row number. ???? PS: I'm deleteing selected row (in datagrid) by pressing a button. Quote
Diesel Posted December 30, 2004 Posted December 30, 2004 What? You don't delete from the Datagrid, you delete from the Dataset bound to the datagrid. Treat the dataset as if it were a database and send it sql commands accordingly. Quote
mcerk Posted January 3, 2005 Author Posted January 3, 2005 I can send SQL commands to dataset? using data reader? how? Quote
Diesel Posted January 3, 2005 Posted January 3, 2005 Ok, not Sql commands, but you can do everything through the dataset object that you can do with Sql. Are you showing one record at a time? After you delete the record are you calling dataAdapter.Update(dataSet)? Are the UPDATE, DELETE and INSERT commands set? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.