Background
I have decided to write this article after considering the requirements of students and beginners that often ask how to insert form data and display the data in a gridview programmatically using a Single Stored Procedure. As a result I have explained those requirements with the basics so they can get an idea of how to submit form data and display it in a gridview using a single Stored Procedure.
So let us start the walkthrough.
Create a table "Student" as in the following:

Create a Stored Procedure named "Studenentryview" as:
- Create procedure studentEntryView
- (
- @Action varchar (10),
- @fname Varchar (50),
- @Mname varchar (50),
- @Lname Varchar (50)
- )
- as
- begin
- If @Action='Insert' --used to insert records
- Begin
- Insert into Student (Fname,MName,Lastname) values (@fname,@Mname,@Lname)
- End
- else if @Action='View' --used to view records
- Begin
- select *from Student
- End
- End
In the preceding Stored Procedure I have declared four variables, they are @Action, @fname, @Mname and @Lname to store Fname, MName and Lastname into the table and the action is used to perform the exact operation; that is view or display as the user requests; in other words if the user inserts the record then the Insert action is executed and if user the user views the record then the view action is to be executed.
Now create the one sample application "StudentEntryView" as:



Vithal WadjePosted Feb 12, 2015, 12:52 PM
great..
Maha LakshmiPosted Feb 12, 2015, 4:06 AM
yes i got how to solve
Maha LakshmiPosted Feb 12, 2015, 1:13 AM
It is showing exception error that expects parameter value
Vithal WadjePosted Feb 11, 2015, 12:43 PM
IN sql server database
Maha LakshmiPosted Feb 11, 2015, 3:55 AM
where the procedure should be created?
Vithal WadjePosted Mar 17, 2014, 7:46 AM
it is a connection string (DataBase connection)
parul mishraPosted Mar 16, 2014, 11:39 PM
what is connection(); please explain
Vithal WadjePosted Feb 12, 2013, 11:18 PM
thanks sir referer my article here http://www.c-sharpcorner.com/UploadFile/0c1bb2/insertselectupdate-delete-records-in-single-stored-proce/
Aarthi RamaniPosted Feb 12, 2013, 12:48 AM
how to create stored procedure? I need step by step process to connect clearly sir......