Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
ASP .Net Datagrid Control
How to implement delete with DataView?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Siegfried Heintze, post: 4258397"] I have a datagrid bound to a dataview which is connected to a dataset which is bound to MSAccess. The following code deletes a record, but not the one for which I click the delete link. I think this is because the data rows are in a different order because of the data view. I think I have to translate the row number I'm receiving. How do I do this? Incidently, is there an easier way to delete a record? I was hoping there was a simple function I could call in the dataset instead of having to populate the parameters of a stored procedure or prepared statement. Thanks, Siegfried Private Sub dgAssertions_DeleteCommand(ByVal source As Object, _ ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) _ Handles dgAssertions.DeleteCommand Dim index As Integer index = e.Item.ItemIndex rebind() ' Add code to delete data from data source. Dim dr As dsAssertions.AssertionsRow = DsAssertions1.Assertions.Rows(index) 'DsAssertions1.Assertions.Rows.RemoveAt(index) daAssertions.DeleteCommand.Parameters(0).Value = dr.nAssertion daAssertions.DeleteCommand.Parameters(1).Value = dr.ridCase daAssertions.DeleteCommand.Parameters(2).Value = dr.A daAssertions.DeleteCommand.Parameters(3).Value = dr.A daAssertions.DeleteCommand.Parameters(4).Value = dr.B daAssertions.DeleteCommand.Parameters(5).Value = dr.B daAssertions.DeleteCommand.Parameters(6).Value = dr.C daAssertions.DeleteCommand.Parameters(7).Value = dr.C daAssertions.DeleteCommand.Parameters(8).Value = dr.D daAssertions.DeleteCommand.Parameters(9).Value = dr.D daAssertions.DeleteCommand.Parameters(10).Value = dr.E daAssertions.DeleteCommand.Parameters(11).Value = dr.E daAssertions.DeleteCommand.Connection.Open() daAssertions.DeleteCommand.ExecuteScalar() rebind() End Sub [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
ASP .Net Datagrid Control
How to implement delete with DataView?
Top