Here, in my article I am going show you how to perform a simple and basic CRUD operation using a paging enabled Grid View in Asp. I have previously written few articles on How to Edit and Delete rows in Grid View and How to Insert Grid View rows in a Database table using Sql Data Source control. However, here I am not using Sql Data Source for data retrieving or manipulation, but using standard code behind procedures. Each event has a role to play while do the CRUD operations. I have written code for each event in the Code behind section.
Grid View Delete Event Args) Dim lbl Book ID As Label = Direct Cast(Grid View1. Text) Private Function Perform_CRUD( By Val i Book ID As Integer, By Val s Book Name As String, By Val s Category As String, By Val d Price As Double, By Val s Operation As String) As Boolean Using con As Sql Connection = New Sql Connection(s Con) Using cmd As Sql Command = New Sql Command("SELECT *FROM dbo. Grid View Update Event Args) Dim lbl Book ID As Label = Direct Cast(Grid View1. Find Control("lbl Book ID"), Label) Dim tb Book Name As Text Box = Direct Cast(Grid View1. Open(); Sql Data Adapter adp = new Sql Data Adapter(sql, con); Data Set ds = new Data Set(); adp. home-View contains buttons with different options like 'insert a record', 'edit a record', 'update a record' ect. so when the user clicks ' Edit a Record' on ' Home-View', programs takes user to ' View Grid).
Sql Client; public partial class Site Master : System.