469,910 Members | 1,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,910 developers. It's quick & easy.

how to convert BLOB DB field to readable format (text)

Hello!

I have a Oracle table with a BLOB field.
Each field is actually a simple text file of several lines.
How to get this BLOB fields in readable format?

I tryied something like
row["DOCLIST"].ToString()

But it give result "System.Byte" instead of actual text...

Thank you,
--
Serge
Nov 16 '05 #1
4 47944
> I have a Oracle table with a BLOB field.
Each field is actually a simple text file of several lines.
How to get this BLOB fields in readable format?

I tryied something like
row["DOCLIST"].ToString()

But it give result "System.Byte" instead of actual text...


look at the GetString(...) method in the Encoding class. this will work for
you.

Regards,
Wiktor Zychla
Nov 16 '05 #2
It doesn't work, or i'm doing something wrong: Cannot implicitly convert
type 'object' to 'byte[]'

againg: I have record: row["DOCLIST"]

If i would save this record from Oracle to disc i will have plaint text
file:

one
two
three
in C#
String typ = row["DOCLIST"].GetType().ToString(); //return System.Byte[]

but all this doesn't work:
System.Byte[] sb = row["DOCLIST"]; //Error: Cannot implicitly convert type
'object' to 'byte[]'
String s = System.Text.Encoding.UTF8.GetString((row["DOCLIST"])); //Error:
Cannot implicitly convert type 'object' to 'byte[]'
String s2 =
System.Text.Encoding.UTF8.GetString(row["PACKAGENAME"].ToString()); //Error:
Cannot implicitly convert type 'object' to 'byte[]'
I have a Oracle table with a BLOB field.
Each field is actually a simple text file of several lines.
How to get this BLOB fields in readable format?

I tryied something like
row["DOCLIST"].ToString()

But it give result "System.Byte" instead of actual text...


look at the GetString(...) method in the Encoding class. this will work

for
Nov 16 '05 #3
This is working:

Byte[] byteBLOBData = new Byte[0];
byteBLOBData = (Byte[])(row["DOCLIST"]);
String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);

Tnx for your help.
againg: I have record: row["DOCLIST"]

If i would save this record from Oracle to disc i will have plaint text
file:

one
two
three
in C#
String typ = row["DOCLIST"].GetType().ToString(); //return System.Byte[]

but all this doesn't work:
System.Byte[] sb = row["DOCLIST"]; //Error: Cannot implicitly convert type
'object' to 'byte[]'

Nov 16 '05 #4
> Byte[] byteBLOBData = new Byte[0];
byteBLOBData = (Byte[])(row["DOCLIST"]);
String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);


then this should work also:

byte[] byteBLOBData = (Byte[])(row["DOCLIST"]);
String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);
Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by stprsbk | last post: by
1 post views Thread by Matt | last post: by
2 posts views Thread by jith87 | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.