概述
转载的.....C#读取Clob数据并转换为字符串:
using System.Data.OracleClient;
using System.IO;
using System.Text;
int
actual
=
0
;
// this.FreeTextBox1.Text = "<FONT color=#ffc0cb>this is as test</FONT>";
OracleConnection conn = new OracleConnection( " Data Source=INFOPLAT;User ID=infomanager;Password=admin; " );
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
String strSql = " SELECT 相关链接 FROM xxtable where SN='88' " ;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
try
... {
conn.Open();
OracleDataReader reader = cmd.ExecuteReader();
while (reader.Read())
...{
OracleLob myOracleClob = reader.GetOracleLob(0);
StreamReader streamreader = new StreamReader(myOracleClob, Encoding.Unicode);
char[] cbuffer = new char[100];
while ((actual = streamreader.Read(cbuffer, 0, cbuffer.Length)) > 0)
...{
String test = new string(cbuffer, 0, actual);
FreeTextBox1.Text = test;
}
break;
}
}
catch (Exception ex)
... {
}
finally
... {
// 释放占有资源
conn.Close();
}
// this.FreeTextBox1.Text = "<FONT color=#ffc0cb>this is as test</FONT>";
OracleConnection conn = new OracleConnection( " Data Source=INFOPLAT;User ID=infomanager;Password=admin; " );
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
String strSql = " SELECT 相关链接 FROM xxtable where SN='88' " ;
cmd.CommandText = strSql;
cmd.CommandType = CommandType.Text;
try
... {
conn.Open();
OracleDataReader reader = cmd.ExecuteReader();
while (reader.Read())
...{
OracleLob myOracleClob = reader.GetOracleLob(0);
StreamReader streamreader = new StreamReader(myOracleClob, Encoding.Unicode);
char[] cbuffer = new char[100];
while ((actual = streamreader.Read(cbuffer, 0, cbuffer.Length)) > 0)
...{
String test = new string(cbuffer, 0, actual);
FreeTextBox1.Text = test;
}
break;
}
}
catch (Exception ex)
... {
}
finally
... {
// 释放占有资源
conn.Close();
}
转载于:https://www.cnblogs.com/jin20000/archive/2009/07/15/1523963.html
最后
以上就是朴素大雁为你收集整理的转载:C#读取clob的全部内容,希望文章能够帮你解决转载:C#读取clob所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复