zoukankan      html  css  js  c++  java
  • 转载: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();
            }
     
    转的多了,自然也就会了.
  • 相关阅读:
    Assembly Manifest 通俗简易手册
    CruiseControl服务器安装配置
    关于URL编码
    从A到Z来说说Web开发
    通过注册表查看 .NET Framework的版本信息
    云数据存在哪里?
    C#中你可能不知道的8件事(zz)
    用PBKDF2 或BCrypt 来存储密码
    C++编译器什么时候为我们自动生成拷贝构造函数?
    C#中你可能不知道的8件事(zz)
  • 原文地址:https://www.cnblogs.com/jin20000/p/1523963.html
Copyright © 2011-2022 走看看