我想在用户从数据库进入时选择相应的用户部门并将用户发送到相应的页面
SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Projects\\csharp\\Drawing\\App_Data\\Drawing.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd;
SqlDataReader dr;
protected void Button1_Click(object sender, EventArgs e)
{
conn.Open();
cmd = new SqlCommand("Select * from userstable where Name ='" + TextBox1.Text + "'and Password='"+TextBox2.Text+"'", conn);
dr = cmd.ExecuteReader();
if (!dr.Read())
{
Response.Write("User name or password Incorrect");
}
else {
\\I have a column for department in my database how to select it(it has 4 separate departments)
}