qasanov
qasanov

Reputation: 437

c# - reading/writing blob from 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?

Upvotes: 1

Views: 4424

Answers (1)

mandel
mandel

Reputation: 2947

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.

Upvotes: 2

Related Questions