I have a varchar in the database 52669 ( or something like that) that I store in a namecollection with other variables for user info and would like to change it to bytes so I can use bitwise to see if they have access level "1". What I need to do is change the Login._userInfo["Access"] from string to byte so I can do the bitwise to see if they have access however i get cannot use operator & with bytes[] or bytes when converting ["Access"] to ascii bytes.
Can anyone help me with a simple method to check if byte 1 exists in byte #####
here is what i have
Here is the error I get
Can anyone help me with a simple method to check if byte 1 exists in byte #####
here is what i have
Code:
long can = StrToByteArray(Login._userInfo["Access"]) & _AXS_LOGIN_;
if (can == 0)
{
MessageBox.Show("You do not have access to use this application.\n\n"+
"Please have your supervisor grant you access!");
Environment.Exit(1);
}
// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}
Code:
Error 1 Operator '&' cannot be applied to operands of type 'byte[]' and 'byte'
Comment