Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written a SP in SQL SERVER 2005 for UPDATE .
I want to know that how I can call that SP in ASP.NET..?
Posted
Updated 9-Jun-10 20:15pm
v4

Below code may help you out :

string connectionstring = "what ever"
SqlConnection conn = new SqlConnection(connectionstring);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_to_be_called";
cmd.Connection = conn;

To add the parameters :

cmd.Parameters.Add("@id_of parameter",SqlDbType.Int).Value = value;

Hope this helped.

All the best !
 
Share this answer
 
Comments
shekhar009 10-Jun-10 5:01am    
Thanks...a lot..it really helps me..
You have not mentioned whether you are using C# or VB.Net.

However....see here[^] for a sample in VB.Net.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900