0% found this document useful (0 votes)
70 views13 pages

Lab File 1

The document provides steps for working with a GridView control in ASP.NET to display and manipulate data from a SQL database. The steps include: connecting to a database, adding tables, adding a SqlDataSource, configuring the GridView, adding stored procedures for CRUD operations, configuring the data source, adding controls like text boxes and buttons, and coding the controls to insert, delete, update and display data in the GridView by calling the stored procedures. Following these steps allows building a basic ASP.NET web form application to work with a SQL database using a GridView.

Uploaded by

Ishdeep Singla
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views13 pages

Lab File 1

The document provides steps for working with a GridView control in ASP.NET to display and manipulate data from a SQL database. The steps include: connecting to a database, adding tables, adding a SqlDataSource, configuring the GridView, adding stored procedures for CRUD operations, configuring the data source, adding controls like text boxes and buttons, and coding the controls to insert, delete, update and display data in the GridView by calling the stored procedures. Following these steps allows building a basic ASP.NET web form application to work with a SQL database using a GridView.

Uploaded by

Ishdeep Singla
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

ASP.

NET LAB WORK

Submitted To:-

Submitted By: Ishdeep single Roll No: 801131012 S.E-M.E

Index

S.No 1.

Name Of exercise

Page Remarks No 1-13

Working With GRID VIEW

2.

3.

4.

5. 6.

7.

1.How to Work With GRID VIEW.


Step-I Open Webpage in C# and The place GRID VIEW in default.aspx window

Step-II Connect To Data Base Go to server explorer Do Right Click And click on Add connect

The fill the details as shown in fig. Step-III Add new Table

Then add tables according to your need and as shown in fig.

Step-IV:- Add SqlDataSource to Default.aspxs design view.

Step-V Open Default.aspx window and open GridView Tasks and the Select the Options as shown in fig., Then choose data source.

Step-VI: Add some stored procedures, these procedures tell what operations you want to perform.

Add Stored Procedures One by One With Following Code. Procedure For Delete Create PROCEDURE delemp ( @empno int ) AS delete from emp where empno=@empno RETURN

Procedure For update ALTER PROCEDURE updemp ( @empno int, @ename varchar(50), @eadd varchar(50), @esal int ) AS update emp set ename=@ename,eadd=@eadd,esal=@esal where empno=@empno RETURN Procedure For Insert ALTER PROCEDURE ins ( @empno int, @ename varchar(50), @eadd varchar(50), @esal int

) AS insert into emp values (@empno,@ename,@eadd,@esal) RETURN Procedure find ALTER PROCEDURE findemp ( @empno int ) AS select * from emp where empno=@empno RETURN Procedure For display or select ALTER PROCEDURE disemp AS select * from emp RETURN

Step-VII Now Configure the data source.

Now Do As shown in Fig.s

Now click on next after selecting the your database name

Select Stored Procedures as per operations defined in Tab Bar

Now you may check the output after clicking on start Debugging button.

STEP-VIII: Now Place 4 text boxes and one Insert Button From Tool Box.

STEP-IX Now Do coding for insert button and GridView

Step-X Now Open the sqlDataSources Properties to have connection with text boxes.

Step-XI Now first Click On DeleteQuery IN SqlDataSource1s Properties, then Parameter Source Control and ControlID Textbox1

Repeate this step for InsertQuery, SelectQuery and UpdateQuery. Step-XII: Now you may check the output after clicking on start Debugging button

Now We can Insert, Delete , Select , Edit and Update any Row/Colum.

You might also like