这是登录页面。
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void Button1_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(...);
cn.Open();
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM inquiry2 WHERE email = @email AND passwrd = @passwrd", cn);
using (cn)
{
sda.SelectCommand.Parameters.AddWithValue("@email", this.TextBox1.Text);
sda.SelectCommand.Parameters.AddWithValue("@passwrd", this.TextBox2.Text);
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
Response.Redirect("QUESTION3.aspx");
}
else
{
Response.Write("INVALID Username and Password, Try Again!");
}
}//end using cn
cn.Close();
}//END BUTTON1_CLICK
}
}
一旦用户使用包含数据表中数据的下拉列表登录,我想在欢迎页面中使用上述信息。