Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将二进制内容存储到sqlite数据库中_C#_Binary - Fatal编程技术网

C# 将二进制内容存储到sqlite数据库中

C# 将二进制内容存储到sqlite数据库中,c#,binary,C#,Binary,我将图像存储到sqlite数据库中。指定的类型是图像字段中的BLOB fir。下面是存储它的代码 FileInfo uploadedFileInfo = new FileInfo(Filename); FileStream fs = fileInfo.OpenRead(); byte[] content = new byte[fs.Length]; fs.Read(content, 0, content.Length); fs.Close(); 并将此内容存储到数据库中。有时归档;oad失败。

我将图像存储到sqlite数据库中。指定的类型是图像字段中的BLOB fir。下面是存储它的代码

FileInfo uploadedFileInfo = new FileInfo(Filename);
FileStream fs = fileInfo.OpenRead();
byte[] content = new byte[fs.Length];
fs.Read(content, 0, content.Length);
fs.Close();
并将此内容存储到数据库中。有时归档;oad失败。 此c#代码在64位计算机中作为windows服务运行。目标是任何CPU。 代码中有什么错误吗。或者我需要将目标设置为x86。欢迎您的反馈!。
SQLite是一个本机组件,因此需要将interop.dll放在单独的文件夹中(在System.Data.SQLite.dll下面)


你有什么错误?发布错误!除此之外,您忽略了
Read
的返回值,这绝不是一个好主意。但你没有告诉我们“有时文件上传失败”是什么意思。
/System.Data.SQLite.dll (core assembly)
/x86/SQLite.Interop.dll (x86 native interop assembly)
/x64/SQLite.Interop.dll (x64 native interop assembly)