c#读取oracle blob,c# – 读取Oracle BLOB字段
我尝试读取Oracle BLOB字段并将内容显示为richTextBox.我在谷歌找到的例子几乎相同,但我仍然无法让它工作.我知道BLOB字段包含序列化数据.这是我到目前为止:(连接读者工作正常)private void button1_Click_1(object sender, EventArgs e){//testen of een blob is uit te lezenOracleCom
我尝试读取Oracle BLOB字段并将内容显示为richTextBox.我在谷歌找到的例子几乎相同,但我仍然无法让它工作.
我知道BLOB字段包含序列化数据.
这是我到目前为止:
(连接读者工作正常)
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 += "";
}
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)