存储过程的调用!
string x = @"server=HP-PC\SQLEXPRESS;IntegratedSecurity=true;Initial Catalog=bydticket";
SqlConnection scon = new SqlConnection(x);
SqlCommand scmm = new SqlCommand();
scmm.CommandText = "mylogin3";
scmm.CommandType = System.Data.CommandType.StoredProcedure;
scmm.Connection = scon;
SqlParameter param = new SqlParameter();
param.SqlDbType = System.Data.SqlDbType.NVarChar;
param.Size = 8;
param.ParameterName = "@username";
param.Value = this.txtuser.Text;
scmm.Parameters.Add(param);
param = new SqlParameter("@password",System.Data.SqlDbType.VarChar, 16);
param.Direction = System.Data.ParameterDirection.Output;
scmm.Parameters.Add(param);
scon.Open();
scmm.ExecuteNonQuery();
string mima=scmm.Parameters["@password"].Value.ToString();
if (this.txtuser.Text == "" || this.txtpassword.Text =="")
{
Response.Write("请输入用户名/密码!");
}
else if (this.txtpassword.Text == mima)
{
Response.Write("登陆成功!");
}
else
{
Response.Write("用户名/密码错误!");
}
scon.Close();