Hello All,
To call a stored procedure you need to set CommandType property of SQLCommand to CommandType.StoredProcedure. Following is the sample code for the same:-
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["<<YourConnectionStringKey>>"].ToString()); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); cmd.Connection = con; cmd.CommandText = "<<Stored Procedure Name>>" cmd.CommandType = CommandType.StoredProcedure; DataSet ds = new DataSet(); da.Fill(ds);
Any ?’s, Please let me know. Thanks.
0 Comments.