title: Check stored procedure parameter to check the user role
body: <p>I need to check in C# if the user has a particular role from the database and in windows form my login code is</p>
  
  <pre><code> SqlCommand cmd = new SqlCommand("SELECT UserName,Password FROM EMP_Info WHERE UserName='" + txt_Username.Text + "' and Password='" + txt_password.Text + "'", sqlcon);
  
   SqlDataAdapter da = new SqlDataAdapter(cmd);
   DataTable dt = new DataTable();
   da.Fill(dt);
  
   if (dt.Rows.Count &gt; 0)
   {
       Cursor.Current = Cursors.WaitCursor;
       // I need to make if here to check the role if the user is admin or not 
       // if admin do something 
       MessageBox.Show("Welcome " + txt_Username.Text);
   }
   else
   {
       MessageBox.Show("The Username or Password you entered is incorrect. Please try again");
       sqlcon.Close();
   }
  </code></pre>
  
  <p>My database code </p>
  
  <pre><code>create proc Check_role 
         @EMP_Role  varchar (10),
      as
      begin
  
          if (exists(select EMP_Role from EMP_Info where EMP_Role ='Admin' ))
              return 1
          else
              return 2
      end
  </code></pre>
  
  <p>so i need to solve this problem </p>