Getting a byte array stored in an INT field in a database
1 answer
Well, the data is stored as an integer. How do you want to convert this to a byte array. Given the input, say 12345, what should the output be?
Why are you trying to store a byte array in an integer column?
EDIT: Now that we know that these are basically the flags you want, I would not convert it to a byte array, I would use an enum:
[Flags]
public enum Permissions
{
Read = 1,
Write = 2,
Execute = 4,
Guillotine = 8,
Lynch = 16
// etc
}
Then you can just throw:
Permissions permissions = (Permissions) (int) dr["Field"]
+1
source to share