public byte[] GetProImg(string JID)
{
byte[] Buffer = null;

using (OracleConnection conn = new OracleConnection(Pub.ConnectionString))
{
try
{
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "select PDC_FJ from tb t where JID= :p1";
cmd.Parameters.AddWithValue("p1", JID);
OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
if (dr.Read())
{
OracleLob myLob = dr.GetOracleLob(0);
int myLength = Convert.ToInt32(myLob.Length);
Buffer = new byte[myLength];
myLob.Read(Buffer, 0, myLength);
}
dr.Close();
}
catch (System.Data.OracleClient.OracleException ex)
{
throw new Exception(ex.Message);
}
finally
{
conn.Close();
}

}
return Buffer;
}

img.aspx:

protected void Page_Load(object sender, EventArgs e)
{
JHAC.BLL.Product bllpro = new JHAC.BLL.Product();
string jid = "";
if (Page.Request["Jid"] != null && Page.Request["Jid"].ToString() != "")
{
jid = Page.Request["Jid"].ToString();
}
byte[] imgByte = bllpro.GetProImg(jid);
if (imgByte != null)
{
this.Response.Clear();
this.Response.BinaryWrite(imgByte);
}
}

从blob字段读取图片 在浏览器显示的更多相关文章

  1. java IO流读取图片供前台显示

    最近项目中需要用到IO流来读取图片以提供前台页面展示,由于以前一直是用url路径的方式进行图片展示,一听说要项目要用IO流读取图片感觉好复杂一样,但任务下达下来了,做为程序员只有选择去执行喽,于是找了 ...

  2. Servlet从本地文件中读取图片,并显示在页面中

    import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpSer ...

  3. spring从服务器磁盘读取图片,然后显示于前端页面上

    需求是,前台通过传参,确定唯一图片,然后后台在服务器磁盘中读取该图片,然后显示于前台页面上. 后台代码: @RequestMapping("unit/bill/showeinvoice&qu ...

  4. 分块读取Blob字段数据(Oracle)

    试过了MSSQL的分块读取Blob字段,又尝试在Oracle下完成,发现还是可行的. 首先建立一个存储过程: create or replace procedure PRO_GET_BLOB(     ...

  5. odp.net 读写oracle blob字段

    DEVELOPER: ODP.NET Serving Winning LOBs: http://www.oracle.com/technetwork/issue-archive/2005/05-nov ...

  6. ajax读取图片后排列问题(先加载完图片再排列)

    网上找了个瀑布流的图片排列插件.从数据库读取图片路径后显示时出现了位置重叠问题. $.ajax({ type: "POST", url: "index.aspx" ...

  7. (转载)VB 查询Oracle中blob类型字段,并且把blob中的图片以流的方式显示在Image上

    原文摘自:http://heisetoufa.iteye.com/blog/ '模块代码 Private Declare Function CreateStreamOnHGlobal Lib &quo ...

  8. C#读取Mysql blob字段 (转帖)

    http://blog.csdn.net/config_man/article/details/6123191 开发环境:Windows XP Professional SP3.VS2008.Winf ...

  9. MVC中根据后台绝对路径读取图片并显示在IMG中

    数据库存取图片并在MVC3中显示在View中 根据路径读取图片: byte[] img = System.IO.File.ReadAllBytes(@"d:\xxxx.jpg"); ...

随机推荐

  1. IE6不能用class命名!IE6不能用class命名!IE6不能用class命名! 重要的事情说3遍

    IE6不能用class命名!IE6不能用class命名!IE6不能用class命名!  重要的事情说3遍

  2. bootstrap-datetimepicker使用记录

    版本:V2.0 1.bootstrap-datetimepicker.min.css 2.bootstrap-datetimepicker.min.js 3.bootstrap-datetimepic ...

  3. Centos6.5使用yum安装Mysql5.7

    想要玩新的东东就要付出代价,我的时间悄悄的都溜走了,说多了都是泪! 实践才是真理! 系统版本:Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 ...

  4. 搭建hadoop2.6.0集群环境

    一.规划 (一)硬件资源 10.171.29.191 master 10.171.94.155  slave1 10.251.0.197 slave3 (二)基本资料 用户:  jediael 目录: ...

  5. centos6.6安装mysql5.7.6(采用MySQL Yum Repository)—(先看最后一行)

    在centos6.6系统上采用MySQL Yum Repository安装mysql5.7.6: 帮助文档:http://dev.mysql.com/doc/refman/5.7/en/linux-i ...

  6. pyglet: a cross-platform windowing and multimedia

    pyglet pyglet: a cross-platform windowing and multimedia library for Python.

  7. first move advantage_百度搜索

    first move advantage_百度搜索 先动优势

  8. sizeof(long)

    16位系统:long是4字节,int是2字节32位系统:long是4字节,int是4字节64位系统:long是8字节,int是4字节

  9. Go--包引用介绍

    最近在学习Go编程,本文简单的叙述如何在Go编程中使用包(包管理). 和其他大多数语言一样,Go也存在包,并使用package关键字定义一个包.首先介绍在程序中如何引入包,引入包有以下几种方式: 1. ...

  10. c语言指针点滴1

    #include <stdio.h> #include <stdlib.h> void main() { int *p = NULL;//指针开始最好都初始化为空 if(p = ...