Professional Documents
Culture Documents
HOW TO DO INSERT, UPDATE, DELETE AND SELECT in Gridview Without Writing A
HOW TO DO INSERT, UPDATE, DELETE AND SELECT in Gridview Without Writing A
HOW TO DO INSERT, UPDATE, DELETE AND SELECT in Gridview Without Writing A
STEP 1:
FIRST CREATE TABLES & STORED PROCEDURES IN SQL SERVER:
Stud_ID=@Stud_ID
Step 3:
drag and drop a "sql datasource" control from the datatab of the tool box
and place it in .aspx page
Step 4:
now click on the smart tag(">") of sqldatasource-->>
configure datasource-->>new connection--->>>and create a connection with your
database--->>>ok--->>next--->>>next--->>>
Step 5:
now select "Specify a custom SQL statement or stored procedure" option--->>
now in the,
SELECT TAB--->>> choose "stored procedure" option--->>
and select "sp_Select"
UPDATE TAB--->>> choose "stored procedure" option--->>
and select "sp_Update"
DELETE TAB--->>> choose "stored procedure" option--->>
and select "sp_Delete"
now give next--->>>finish.
Step 6:
now drag and drop a gridview control into the .aspx page
Step 7:
now click on the smart tag(">") of gridview-->>choose datasource options to
sqldatasource1--->>>
and also enable the check boxes such as
sorting,
paging,
editing,
deleting,
selection
thats it!!! now the run the program and see a gridview with
asp.net.
In the web.config file under <appSettings> tag declare the constants.
example:
<appSettings>
<add key="SqlConnection_local" value="Server=vijay-
PC\SQLEXPRESS;Database=Student;User ID=vijay;password=123;Persist Security
Info=True;"/><!--Ex: For Database Connection String-->
<add key="clientURl" value="http://localhost:1555/YearBook/"/><!--Ex: For WebSite URI-->
<add key="PI" value="3.14159265"/><!--Ex: For Mathematical Constant Values-->
</appSettings>