//存储过程登录
string scon = System.Configuration.ConfigurationManager.ConnectionStrings["scon"].ConnectionString;
protected void btnlogin_Click(object sender, EventArgs e)
{
using(SqlConnection conn=new SqlConnection(scon))
{
conn.Open();
SqlCommand comm = new SqlCommand("sp_Login",conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.Add("@name",SqlDbType.VarChar,50);
comm.Parameters.Add("@pwd",SqlDbType.VarChar,50);
comm.Parameters.Add("@msg",SqlDbType.VarChar,50);
comm.Parameters["@name"].Value = txtname.Text;
comm.Parameters["@pwd"].Value = txtpwd.Text;
comm.Parameters["@msg"].Direction = ParameterDirection.Output;
comm.ExecuteNonQuery();
Response.Write("<script>window.alert('"+comm.Parameters["@msg"].Value+"');</script>");
}
}