I try to read an Oracle BLOB field and show the content i a richTextBox. The examples i find with google are almost the same but still i can't get it to work. I know that the BLOB field contains serialized data. This is what i have so far: (the connecetion en reader work fine)
private void button1_Click_1(object sender, EventArgs e)
{
//testen of een blob is uit te lezen
OracleCommand cmd = new OracleCommand();
cmd.Connection = OraConnection.conn;
cmd.CommandText = "select id, blobfield from test_table where id = '20ED7EDB-406A-43E8-945B-5E63DFCBA7FF'";
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
dr.Read();
OracleBlob BLOB1 = dr.GetOracleBlob(1);
Byte[] Buffer = (Byte[])(dr.GetOracleBlob(1)).Value;
string lookupValue = System.Text.ASCIIEncoding.ASCII.GetString(Buffer);
richTextBox1.Text += lookupValue; //shows: DQStream
richTextBox1.Text += "";
richTextBox1.Text += "1";
richTextBox1.Text += dr.GetOracleBlob(1).Value; //shows: System.Byte[]
richTextBox1.Text += "";
}
OracleBlob blob = (OracleBlob)dr.GetOracleBlob(1);
– MulciberBlob1
. I just posted some sample code. – MulciberText
property. RTF is a text format, not serialized data. You'll end up displaying the raw file contents, font names and all. – Olly