Asp.net with C #
<p>I want to select the respective department of user when they enter from the database and send users to respective pages</p>

<pre><code>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)
    }
</code></pre>

<hr>
