How to determine the user role that received from database if admin or not
<blockquote>
  <p>i want to to take the user name and password to the database and get the user role according to the inserted user name and password but this code does not work </p>
</blockquote>

<pre><code> public bool Login(out string Msg)
    {
        bool b = true;
        Msg = "";
        SqlConnection con = new SqlConnection(connection.connectstr);
        try
        {
            con.Open();
            SqlCommand com = new SqlCommand("user_proc", con);
            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.Add("@u_name", SqlDbType.NVarChar).Value = this.u_name;
            com.Parameters.Add("@u_password", SqlDbType.NVarChar).Value = this.u_password;
            com.ExecuteNonQuery();

            con.Close();
            b = true;
        }
        catch (Exception ex)
        {
            con.Close();
            Msg = ex.Message;
            b = false;
        }

        return b;
    } 
</code></pre>

<p>and the c# code that should check the role into database and redirect me to server page if admin and client page if not:-</p>

<pre><code>protected void btn_login_Click(object sender, EventArgs e)
    {
        my_user u = new my_user();
        u.u_name = TextBox1.Text;
        u.u_password = TextBox2.Text;
        string m="";

        if (!u.Login(out m))
        {
            lbl_role.Text = "error";                
        }
        else
        {
            if (u.u_role == "admin")
            {
                Response.Redirect("testclient.aspx");
            }
            else Response.Redirect("testserver.aspx");

        }
    }
</code></pre>

<p>and the database procedure that performs that task is:</p>

<pre><code>create procedure user_proc  
  (@u_name nvarchar(50) , 
  @u_password nvarchar(50), 
  @u_role nvarchar(50))
  as 
  begin
  begin try
  begin transaction  
  if exists (select u_role from user_sys
 where u_name=@u_name and u_password= @u_password)
  commit
End try
Begin catch
rollback
declare @msg varchar(200)
set @msg = ERROR_MESSAGE()
raiserror(@msg , 16 , 1)
End catch
End
</code></pre>