我在使用 C# 的 Firebird 数据库中有一个类似“BLOB_SUB_TYPE_0”的字段。如何导出图片?
C# 控制台.App
using (var conn = new FbConnection(connectionString))
{
conn.Open();
using (var command = new FbCommand(sql, conn))
{
using (var reader = command.ExecuteReader()) {
var sb = new StringBuilder();
while (reader.Read()) {
string fileName = reader["DOSYAADI"].ToString();
byte[] blob = (byte[])reader["FILEDATA"];
// create a file FileStream to write the data
FileStream fs = new FileStream(@"D:\" +fileName, FileMode.Create);
fs.Write(blob, 0, blob.Length);
fs.Close();
}
}
}
}