The Grid View control is a tabular databound control but sometimes it is used like a spreadsheet control. NET 2.0 and is an improved version of the Data Grid control. We can use this to display data from a database and edit, sort and select the data.
Database Table Structure We are using an "EMPLOYEE" table so the "EMPLOYEE" table design is: Design of Grid View We design a Grid View with which we can perform update and delete operations.
Find Control("txtaddress"), Text Box) Dim city As Text Box = Direct Cast(grid View.
In this article we will look at how to update or delete a record in a database table using a Grid View control.
aspdotnet-suresh offers C#articles and tutorials,csharp dot net,articles and tutorials, VB.
In previous post we discussed how to create 3 – tier architecture application using c#.
Now let’s create a method for executing the Update or Insert.
Nor does it represent the opinion of my dog, because I don’t have one.In the previous article , we learned how to create a simple Grid View at runtime . Sql Client; public partial class _Default : System. Open() Dim cmd As New Sql Command("Select * from stores", con) Dim da As New Sql Data Adapter(cmd) Dim ds As New Data Set() da. Page Private con As New Sql Connection("Data Source=.; Initial Catalog=pubs; User ID=sa; Password=*****") Protected Sub Page_Load(By Val sender As Object, By Val e As System. Load If Not Is Post Back Then load Stores() End If End Sub Protected Sub load Stores() con. Stored Procedure for SELECT set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[USERMST_INSERT] @NAME AS NVARCHAR(256), @ADD AS NVARCHAR(256), @CITY AS NVARCHAR(256), @EMAIL AS NVARCHAR(256) AS BEGIN INSERT INTO USERMST VALUES (@NAME,@ADD,@CITY,@EMAIL) END set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[USERMST_UPDATE] @ID AS INT, @NAME AS NVARCHAR(256), @ADD AS NVARCHAR(256), @CITY AS NVARCHAR(256), @EMAIL AS NVARCHAR(256) AS BEGIN UPDATE USERMST SET [email protected], [email protected], [email protected], [email protected] WHERE [email protected] END Now, we all know as write sql connection code in data access layer.