惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
量子位
D
DataBreaches.Net
博客园 - 司徒正美
J
Java Code Geeks
博客园 - 【当耐特】
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
B
Blog
The Cloudflare Blog
D
Docker
I
InfoQ
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
S
SegmentFault 最新的问题
GbyAI
GbyAI
有赞技术团队
有赞技术团队

博客园 - ZH.net

在vb.net中通过ODBC从Oracle 9i向Access倒数据 从SQLSERVER向ORACLE8迁移的技术实现方案 Part V [转] 从SQLSERVER向ORACLE8迁移的技术实现方案 PartIV [转] 从SQLSERVER向ORACLE8迁移的技术实现方案 PartIII [转] 从SQL SERVER向ORACLE的迁移方案[转] PartII Sql Server 转入 Oracle part I (转自网络) 在 .NET 中使用 Oracle 数据库事务 作者:Jason Price 转自oracle.com Oracle Trigger(转自网络) Oracle的分页以及sequence 一些正则表达式 - ZH.net - 博客园 将文件(word,excel等)存入oracle的一个字段 .net studio 2005操作dbf文件 Web利用Gloabl.asax实现多线程任务 maintain AD(将一个账号移动到另一个群组) 一個Check AD的类。from MSDN 一些JS ViewState的一些学习笔记 发mail时smtp服务器设置的一个问题 datagrid前加checkbox
接昨日,将上传至oracle的excel文件下载下来
ZH.net · 2006-03-14 · via 博客园 - ZH.net

代码如下
try
        {
            DBHelper db = DBHelper.DBHelperInstance(System.Configuration.ConfigurationSettings.AppSettings["DataBaseType"]); ;
            OracleConnection oconn = new OracleConnection(db.pcsConnectionString);
            oconn.Open();

            string strSQL = "select DOC from exceltodb where fileid='1112'";
            OracleCommand OCMD = new OracleCommand(strSQL, oconn);
            OracleDataReader Ord = OCMD.ExecuteReader(CommandBehavior.SequentialAccess);
            int bufferSize = 100;
            byte[] outbyte = new byte[bufferSize];
            long retval;                            // The bytes returned from GetBytes.
            long startIndex = 0;
            Response.AddHeader("Content-Type", "application/vnd.ms-excel");
            Response.AddHeader("Content-Disposition", "attachment;filename=test.xls");
            if(Ord.Read())
            {
                // Reset the starting byte for the new BLOB.
                startIndex = 0;

                // Read the bytes into outbyte[] and retain the number of bytes returned.
                retval = Ord.GetBytes(0, startIndex, outbyte, 0, bufferSize);

                // Continue reading and writing while there are bytes beyond the size of the buffer.
                while (retval == bufferSize)
                {
                    this.Response.BinaryWrite(outbyte);
                    this.Response.Flush();

                    // Reposition the start index to the end of the last buffer and fill the buffer.
                    startIndex += bufferSize;
                    retval = Ord.GetBytes(0, startIndex, outbyte, 0, bufferSize);
                }

                // Write the remaining buffer.
                this.Response.BinaryWrite(outbyte);
                this.Response.Flush();
             }
             Ord.Close();
             oconn.Close();
                this.Response.End();
           }
           catch(Exception ex)
           {
             this.Response.Write("<b>ex.Message</b>");
           }
           finally
           {
            
            }

参考自CSDN相关文档