I've got this all except for my...
cmd.Parameters["@CAssetID"].Value.ToString();
Line of code where I am trying to assign the session variable to SqlParameter to pass it in to a stored procedure. I just can't seem to get the syntax right. I've tried several different things here is my last attempt.
SqlConnection RejectConnecton = new SqlConnection("Data Source=GBAPTCCSR01;Initial Catalog=CInTracDB;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
cmd.CommandText = "usp_RejectSubmission";
cmd.Parameters["@CAssetID"].Value.ToString();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = RejectConnecton;
RejectConnecton.Open();
reader = cmd.ExecuteReader();
RejectConnecton.Close();
Thanks for any help you can offer!
cmd.Parameters["@CAssetID"].Value.ToString();is that where you're trying to set the value?cmd.Parameters["@CAssetID"].Value.ToString();tocmd.Parameters.Add(new SqlParameter("@CAssetID", Session["MySessionVar"]));- may need a little tweaking based on your session variable.