CREATE PROCEDURE ValidationLogin
@LogInName char(50)=NULL,
@Password char(50)=NULL,
@blnError char(255) output
--WITH ENCRYPTION
ASBEGIN
IF exists (select * from [User] where LogInName=(@LogInName))
BEGIN
IF exists (select * from [User] where LogInName=(@LogInName) and Password=(@Password))
BEGIN
set @blnError = '用户登录成功!'
END
ELSE
BEGIN
set @blnError = '用户密码错误!'
END
END
ELSE
BEGIN
set @blnError = '用户名不存在!'
END
ENDGO
string connstr = ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString;
            SqlConnection myConnection = new SqlConnection(connstr);
            SqlCommand myCommand = new SqlCommand("ValidationLogin", myConnection); //存储过程名称
            myCommand.CommandType = CommandType.StoredProcedure; //设置调用的类型为存储过程            myCommand.Parameters.Add("@LogInName", SqlDbType.VarChar,50).Value = txtName.Text.Trim();
            myCommand.Parameters.Add("@Password", SqlDbType.VarChar,50).Value = txtPassword.Text.Trim();
            myCommand.Parameters.Add("@blnError", SqlDbType.VarChar).Direction = ParameterDirection.Output;            myCommand.Connection.Open();
            //SqlDataReader MyRst = myCommand.ExecuteReader();
            myCommand.ExecuteNonQuery();
            //myConnection.Close();
            //string strMsg = myCommand.Parameters["@blnError"].Value.ToString();
            MessageBox("strMsg", "Login.aspx");说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: String[2]: Size 属性具有无效大小值 0。源错误: 
行 41:             myCommand.Connection.Open();
行 42:             //SqlDataReader MyRst = myCommand.ExecuteReader();
行 43:             myCommand.ExecuteNonQuery();
行 44:             //myConnection.Close();
行 45:             //string strMsg = myCommand.Parameters["@blnError"].Value.ToString();