Hi,
Could somebody please advice on the error I am getting while building the solution. The error comes up on the following code (bold and italic):
public static bool CheckUser()
{
SqlConnection myQuery;myQuery = new SqlConnection GetConnectionString(); myQuery.Open();
string UserName = WindowsIdentity.GetCurrent().Name;
SqlCommand getUserID = new SqlCommand("Select level FROM [Admin_user] WHERE [AD_Name] = @UserName", myQuery);
getUserID.Parameters.Add(new SqlParameter("@UserName", SqlDbType.VarChar)).Value = UserName;
SqlDataReader r = getUserID.ExecuteReader();
if (r.HasRows == false)
{
r.Close();
return false;
}
r.Read();
r.Close();
return true;
}Thanks.