C# 将BLOB读取到SQLite表中的字节数组

C# 将BLOB读取到SQLite表中的字节数组,c#,sqlite,blob,C#,Sqlite,Blob,我想将一个blob读取到一个字节数组,并在cmd中显示当前的字节数组 这是我目前的代码: string connector = @"data source=C:\testfile; Version=3;"; SQLiteConnection connection = new SQLiteConnection(connector); SQLiteCommand command = new SQLiteCommand(connection); connection.Open(); comman

我想将一个blob读取到一个字节数组,并在cmd中显示当前的字节数组

这是我目前的代码:

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++;    
}
目前我的代码不工作。它只打印出两行(我在“文件”中有两项):

系统字节[]
系统字节[]

如何让我的代码工作。在这种情况下,阅读所有与c#blob相关的帖子对我没有帮助。我使用了此帮助:

.ToString()
字节[]
上的工作方式与您期望的不同。您将需要以下内容:

Console.WriteLine( Encoding.Default.GetString( bytBLOB ) ) ;
假设blob中的字节表示默认编码中的可打印字符。如果它们是随机数据,则需要逐字节转储它们