读取Oracle中的clob字段

 int actual = 0;


            string strSql = "select producthtml from web_goods where productsn=835";
            OracleDataReader reader= OraHelper.ExecuteReader(OraHelper.CONN_STRING, CommandType.Text, strSql, null);

            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;
            }

posted on 2012-09-13 15:59  jameshappy  阅读(1592)  评论(0编辑  收藏  举报