call stored proc c#
using (SqlConnection conn = new SqlConnection("Server=(local);DataBase=Northwind;Integrated Security=SSPI")) {
conn.Open();
// 1. create a command object identifying the stored procedure
SqlCommand cmd = new SqlCommand("CustOrderHist", conn);
// 2. set the command object so it knows to execute a stored procedure
cmd.CommandType = CommandType.StoredProcedure;
// 3. add parameter to command, which will be passed to the stored procedure
cmd.Parameters.Add(new SqlParameter("@CustomerID", custId));
// execute the command
using (SqlDataReader rdr = cmd.ExecuteReader()) {
// iterate through results, printing each to console
while (rdr.Read())
{
Console.WriteLine("Product: {0,-35} Total: {1,2}",rdr["ProductName"],rdr["Total"]);
}
}
}
Also in C#:
- c# multiple catch exceptions
- c# one line set
- unity how to make a ui disappear
- example HttpClient c# Post
- change z value unity
- c# pull request
- how to check if an integer is in array c#
- unity list length
- while loop c#
- press key run code unity c#
- unity how to rotate something to point to something else
- How to look at an object unity
- unity prevent system from creation
- invalidoperationexception c# ui thread
- unity create gameobject
- unity connect to firebase
- uinput dialog uwp c#
- c# try catch error
- isdaylightsavingtime in c#
- transform object according to its parent unity
- c# anonymous class
- c# stringbuilder
- Rigidbody.addforce
- c# round to closest multiple