Text Into a BLOB Field

  • Thread starter rhill#wfubmc.edu
  • Start date
R

rhill#wfubmc.edu

I need to insert text into an Oracle 9i BLOB field. I
assume there will have to be some conversion to binary
for this to occurr. I have tried to update the BLOB
field with text from a textbox and have not been
sccessful. Can anyone point me in the right direction???

Thanks,

Robert
 
M

Miha Markic

Hi,

The DataColumn should by of byte[] datatype.
To encode string to bytes you shold do something like:
string s = "Tubo";

Encoding e = new UTF8Encoding();

byte[] b = e.GetBytes(s);

To decode (where b is byte[])

string sx = e.GetString(b);

And here is the parameter declaration:

this.oracleInsertCommand1.Parameters.Add(new
System.Data.OracleClient.OracleParameter(":TEST",
System.Data.OracleClient.OracleType.Raw, 0, "TEST"));

HTH,
 
P

Paul Clement

¤ I need to insert text into an Oracle 9i BLOB field. I
¤ assume there will have to be some conversion to binary
¤ for this to occurr. I have tried to update the BLOB
¤ field with text from a textbox and have not been
¤ sccessful. Can anyone point me in the right direction???
¤

BTW, you should be using a CLOB instead of a BLOB for text based data.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top