转自 http://www.linkdns.com/ArticleView/20097/Article_10268.htm
在.net 中读写ORACLE ,LOB 对象 /// /// 读取 ORACLE LOB 大数据列并转换为string类型 /// /// public static string ReadLobField(string strSql, params OracleParameter[] cmdParms) { int actual = 0; StringBuilder sb = new StringBuilder(); using (OracleDataReader reader = OracleHelper.ExecuteReader(strSql, cmdParms)) { while (reader.Read()) { OracleLob myOracleClob = reader.GetOracleLob(0); System.IO.StreamReader streamreader = new System.IO.StreamReader(myOracleClob, Encoding.Unicode); char[] cbuffer = new char[100]; while ((actual = streamreader.Read(cbuffer, 0, cbuffer.Length)) > 0) { String tmpVal = new string(cbuffer, 0, actual); sb.Append(tmpVal); } } } return sb.ToString(); } | |
|