会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
漓江边
漓江边的一颗小小的石头
博客园
首页
新随笔
联系
管理
订阅
转载:C#读取clob
转载的.....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();
}
转的多了,自然也就会了.
posted on
2009-07-15 11:31
漓石
阅读(
1118
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告