Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
21569 Points
2493 Posts
Microsoft
May 02, 2012 08:43 AM|LINK
IAmateur What is the syntax to cal stored procedure from code side?
What is the syntax to cal stored procedure from code side?
Hi,
You could write like this:
SqlConnection conn = new SqlConnection("your_sql_server_connection_string"); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "your sp's name"; //add values to paramters. cmd.Parameters.AddWithValue("@name1", "name1"); conn.Open(); cmd.Connection = conn; cmd.ExecuteNonQuery(); conn.Close();
Thanks.
Chen Yu - MS...
All-Star
21569 Points
2493 Posts
Microsoft
Re: Trigger
May 02, 2012 08:43 AM|LINK
Hi,
You could write like this:
SqlConnection conn = new SqlConnection("your_sql_server_connection_string"); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "your sp's name"; //add values to paramters. cmd.Parameters.AddWithValue("@name1", "name1"); conn.Open(); cmd.Connection = conn; cmd.ExecuteNonQuery(); conn.Close();Thanks.
Feedback to us
Develop and promote your apps in Windows Store