haii
i am a beginner in asp.net....i want to change my work by using stored procedore..i want to enter the empid,name,dept to database by using stored procedure....
haii
i am a beginner in asp.net....i want to change my work by using stored procedore..i want to enter the empid,name,dept to database by using stored procedure....
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vijaya KadiyalaPosted Mar 8, 2008, 5:12 PM
Hi,
The Best thing would be creating one stored procedure for all insert, update, delete actions on the table. You can you al these differernt actions in one single procedure with in Different BEGIN block and having different transactions for each of these.
Thanks -- Vj
http://dotnetvj.blogspot.com
Guest UserPosted Jan 19, 2008, 6:35 PM
ganga nairPosted Jan 19, 2008, 5:14 AM
thank u.........i tried its working
but i want to know one thing also...can i use more than one action ina procedure..means....i tried one stored procedure for insert...in tha same application i want to delete,update,select also......for that i have to write separate procedure or same procedure for all those actions...
Blocked AccountPosted Jan 17, 2008, 6:55 AM
For calling the stored procedure , u have to pass the parameter name and value.
here I am writing the code, which shows the way of calling the SP.
// create and open a connection object
conn = new
SqlConnection("Define Connection here.");
conn.Open();
// create a command object identifying
// the stored procedure name InsertEmpRecord
SqlCommand cmd = new SqlCommand("InsertEmpRecord", conn);
// set the command object so it knows
// to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
// add parameter to command, which
// will be passed to the stored procedure
cmd.Parameters.Add(
new SqlParameter("@EmpID", "Pass the value here"));
cmd.Parameters.Add(
new SqlParameter("@Name", "Pass the value here"));
cmd.Parameters.Add(
new SqlParameter("@Deptt", "Pass the value here"));
cmd.ExecuteNonQuery();
by this way u can call the sp.
Simply write the Stored Procedure. and use this code.
Happy Coding!!