开发者

How to get the blob data from Oracle in C#4.0?

Here i have a requriment to read the data from Oracle DB.In that one column is defined as BLOB.using that data i need to frame the insert query li开发者_开发问答ke this "insert into emp values('100','John',EMP_PIC); Here emp_pic is defined as BLOB.Please suggest me some idea's about this.I am using C#4.0.


perhaps you can use this sample project based on this link. I hope this help.

http://www.codeproject.com/Articles/13365/Insert-retrieve-an-image-into-from-a-blob-field-in

if you wanna get value from blob data using OracleDataReader just convert first byte to image using this:

private Image byteArrayToImage(byte[] byteArrayIn)
        {
            MemoryStream ms = new MemoryStream(byteArrayIn);
            ms.Position = 0;
            Image returnImage = Image.FromStream(ms);
            return returnImage;
        }

then read data blob like this:

picFileData.Image = byteArrayToImage(dr["EMP_PIC"] as byte[]); // dr is OracleDataReader dr;

picFileData is PictureBox from visual studio and EMP_PIC is blob column in Oracle


Try to use LINQ to SQL. This is very useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜