c# - 从 firebird 读取/写入 blob

发布于 2024-07-14 18:02:17 字数 105 浏览 1 评论 0原文

我正在尝试使用 C# 从 firebird 读取图像,并将其保存到文件系统。 我可以从表中读取并保存。 但无法查看图像。 我尝试了很多片 网上的代码。但结果是相同的:( 有人可以帮我吗?

I'm trying to read image from firebird with c#, and save it to file system.
I can read from table and save. but image can not be viewed. I tried many piece of
code on net.but result is same :(
Can any one help me please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉酒的小男人 2024-07-21 18:02:17

您如何从 Firebird 检索代码? 如果您正在获取数据并将其转换为 byte[] ,请尝试:


byte [] blob = row["image"];
// create a file FileStream to write the data
FileStream fs = new FileStream("image.jpg", FileMode.Create); 
fs.Write(blob,0,blob.Length);
fs.Close();

上面的代码应该可以解决问题。

PS:我在代码中做了很多假设,但是你可以明白这个想法。

How are you retrieving the code form Firebird? If you are getting the data and casting it to a byte[] try:


byte [] blob = row["image"];
// create a file FileStream to write the data
FileStream fs = new FileStream("image.jpg", FileMode.Create); 
fs.Write(blob,0,blob.Length);
fs.Close();

The above code should do the trick.

PS: I have made lots of assumption in the code, but you can get the idea.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文