SqlConnection con = new SqlConnection();
con.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["DSN"];
con.Open();
string u_name=Server.HtmlEncode(TextBox1.Text);
string u_pwd=Server.HtmlEncode(TextBox2.Text);
SqlCommand cmdLogin = new SqlCommand("upUserLogin",con);
cmdLogin.CommandType = CommandType.StoredProcedure;
SqlParameter uname = new SqlParameter("@strLoginName",SqlDbType.NVarChar,20 );
uname.Value=u_name;
SqlParameter upwd = new SqlParameter("@strLoginPwd",SqlDbType.NVarChar,20 );
upwd.Value=u_pwd;
SqlParameter isOK = new SqlParameter("@blnReturn",SqlDbType.Bit);
isOK.Direction = ParameterDirection.Output;
cmdLogin.Parameters.Add (uname);
cmdLogin.Parameters.Add (upwd);
cmdLogin.Parameters.Add (isOK);
cmdLogin.ExecuteNonQuery ();
bool a=System.Convert.ToBoolean( cmdLogin.Parameters["@blnReturn"].Value.ToString ());
if(a)
{
Label1.Text="登录成功"+"欢迎您:"+Server.HtmlEncode(TextBox1.Text);
}
else
{
Label1.Text="登录失败!";
}
con.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["DSN"];
con.Open();
string u_name=Server.HtmlEncode(TextBox1.Text);
string u_pwd=Server.HtmlEncode(TextBox2.Text);
SqlCommand cmdLogin = new SqlCommand("upUserLogin",con);
cmdLogin.CommandType = CommandType.StoredProcedure;
SqlParameter uname = new SqlParameter("@strLoginName",SqlDbType.NVarChar,20 );
uname.Value=u_name;
SqlParameter upwd = new SqlParameter("@strLoginPwd",SqlDbType.NVarChar,20 );
upwd.Value=u_pwd;
SqlParameter isOK = new SqlParameter("@blnReturn",SqlDbType.Bit);
isOK.Direction = ParameterDirection.Output;
cmdLogin.Parameters.Add (uname);
cmdLogin.Parameters.Add (upwd);
cmdLogin.Parameters.Add (isOK);
cmdLogin.ExecuteNonQuery ();
bool a=System.Convert.ToBoolean( cmdLogin.Parameters["@blnReturn"].Value.ToString ());
if(a)
{
Label1.Text="登录成功"+"欢迎您:"+Server.HtmlEncode(TextBox1.Text);
}
else
{
Label1.Text="登录失败!";
}