我会议的基础上,从数据库中的数据。
但得到的fallwoing错误。
Error 6 A local variable named 'orderno' cannot be declared in this scope because it would give a different meaning to 'orderno', which is already used in a 'parent or current' scope to denote something else
{C}
我把这个功能<pre>public static string mymsg;
public void GetInvoice(string orderno)
{
SqlConnection con = new SqlConnection(); //Create an SqlConnection object.
//Pass the connection string to the SqlConnection object
con.ConnectionString = connectionString;
con.Open(); //Open the connection
string procedureText = "GetInvoice";
SqlCommand cmd = new SqlCommand(procedureText, con); //Create an SqlCommand object.
cmd.CommandType = CommandType.StoredProcedure; //Change the behaviour of command text to stored procedure.
string orderno = HttpContext.Current.Session["OrderID"]; //error line
cmd.Parameters.Add(new SqlParameter("@OrderID", orderno)); //Pass value to the parameter that you have created in procedure.
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
mymsg = "Thankyou " + dr["FirstName"].ToString() + " For Shopping with us. Your Order Number is:" + dr["OrderID"].ToString()+ "Please keep it for Corresponding with Us. Your Order will be Delivered Soon on ur Given Address: "+dr["Address"].ToString();
//Response.Write("<script>alert('Password is :" + dr[0].ToString() + "')</script>");
}
else
{
Response.Write("<script>alert('User Name does not exist')</script>");
}
con.Close();
{体C3}
我也得到回复于错误
| farooqspecials