Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
clownshoes2009
Starting Member
2 Posts |
Posted - 2009-04-30 : 20:37:29
|
Hi everyone. I have a few problems with Stored procedures.I have two of them that both need to be called on the same page by the same event (Button_Click)The two stored procs are called "AddCustomer" and "AddEntry"Here is my code to call one of them - I wondered if anyone can tell me if it is possible to call them both with the same command? String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["constring"].ConnectionString; SqlConnection con = new SqlConnection(strConnString); SqlCommand cmd = new SqlCommand("AddCustomer", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@OrderID", HttpContext.Current.Session["OrderID"].ToString()); cmd.Parameters.AddWithValue("@FirstName", HttpContext.Current.Session["UserFName"].ToString()); cmd.Parameters.AddWithValue("@LastName", HttpContext.Current.Session["UserFName"].ToString()); cmd.Parameters.AddWithValue("@PhoneNumber", HttpContext.Current.Session["UserPhone"].ToString()); cmd.Parameters.AddWithValue("@Email", HttpContext.Current.Session["UserEmail"].ToString()); cmd.Parameters.AddWithValue("@Address", HttpContext.Current.Session["UserAd"].ToString()); cmd.Parameters.AddWithValue("@PostCode", HttpContext.Current.Session["UserPCode"].ToString()); cmd.Parameters.AddWithValue("@EntryNumber", HttpContext.Current.Session["Entries"].ToString());try { con.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception("Execption adding account. " + ex.Message); } finally { con.Close(); }I'd really appreciate the help! Also have another thread needing a little help finishing off my stored procedures syntax! Any help would be ever so gratefully received.Thanks. |
|
|
|
|