I want to read a blob to a byte array and show the current byte array in the cmd.
This is my code at the moment:
string connector = @"data source=C:\testfile; Version=3;";
SQLiteConnection connection = new SQLiteConnection(connector);
SQLiteCommand command = new SQLiteCommand(connection);
connection.Open();
command.CommandText = "SELECT file FROM users";
SQLiteDataReader reader = command.ExecuteReader();
while (reader.Read())
{
int i = 0;
byte[] bytBLOB = new byte[reader.GetBytes(0, 0, null, 0, int.MaxValue) - 1];
reader.GetBytes(0, 0, bytBLOB, 0, bytBLOB.Length);
Console.WriteLine(bytBLOB.ToString());
i++;
}
Currently my code doesn't work. It just prints out two lines of (I've got two items in "file"):
System.Byte[]
System.Byte[]
How to get my code working. Reading all relevant posts to blob in c# doesn't help me in this situation. I used this help: blogpost