I have been have a bit of an issue with MySqlDataReader.GetBytes
, and referencing the column ordinal.
Table structure:
ID - Primary, int, not null, auto_increment
TNode - , not null
Packet - longblob
Timestamp - timestamp
If I run the following query:
SELECT * FROM table WHERE TNode = 2;
And attempt to get the size of the longblob using the following method:
while (reader.Read())
{
long l = reader.GetBytes(2,0,null,0,0);
}
I will receive the following error:
GetBytes can only be called on binary or guid columns
Which, column index 2 is. Even if I iterate through all of the columns, as expected, I receive the same error. But if I run the following query:
SELECT Packet, ID, Timestamp FROM table WHERE TNode = 2;
Followed by:
while (reader.Read())
{
long l = reader.GetBytes(0, 0, null, 0, 0);
}
No problems. I am able to get the length of the longblob, and do what I need to do with it.
Any ideas as to why it is not allowing me to use a non-zero column index?
Thank you.