c#-从firebird读取/写入blob [英] c# - reading/writing blob from firebird

查看:167
本文介绍了c#-从firebird读取/写入blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

您如何检索Firebird的代码?如果要获取数据并将其转换为字节[],请尝试:

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:我在代码中做了很多假设,但是您可以理解.

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

这篇关于c#-从firebird读取/写入blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆