2.Create a new database by right clicking on the database in Object Explorer and give your Database name.

3.Create a table “Employee” with fields “EmployeeNo(int), EmployeeName(varchar(max)),Designation(varchar(max)) and EmployeeSalary(int).

4.Open“Employee” table in the database and add sample data as follows.

Step-2

Create Website:

5.Open Microsoft Visual Studiogo to File menu >> click onNew Website it opens a window then choose “ASP.NET Website” template from the list of available templates and choose language as C# and location as File System.

6.Add the parameters to add the textbox values to the command object .

using try,catch ,finally blocks here inorder to handle errors in a block of code.In this try block, connection is opened to connect to sqlserver ,executes the query and in finally block closes the connection ,dispose the command and dispose the connection.DataBind method will bind the data to the table in GridView.

6.Add the parameters to add the textbox values to the command object .

using try,catch ,finally blockshere inorder to handle errors in a block of code.In this try block, connection is openedto connect to sqlserver ,executes the query and the finally block closes the connection ,dispose the command and dispose the connection. DataBind method will bind the data to the table in GridView.

Delete the data from database

create storedprocedure to Delete the data in the database

CREATEPROCEDURE DeleteEmpDetails

-- Add the parameters for the stored procedure here

@EmployeeNo int

AS

BEGIN

SETNOCOUNTON;

DELETEFROM Employee WHERE EmployeeNo=@EmployeeNo

END

GO

The followingview is to delete the employee record by passing employee number.

6.Add the parameters to add the textbox values to the command object .

using try,catch ,finally blockshere inorder to handle errors in a block of code.In this try block, connection is openedto connect to sqlserver ,executes the query and the finally block closes the connection ,dispose the command and dispose the connection. DataBind method will bind the data to the table in GridView.

Conclusion

By using this simple code we can easily perform operations such as Insert,Update,Delete,Load onto the Database.

hi,
this article is very good. but i found some problem when using. You have not mention how to bind delete, update & insert methods in the main program or how will they execute. In the coding you are using TXTEMPLOYEENO.TEXT etc. where are these text boxes. Plz. help.