广 告
信息技术应用 >>  C#中从数据库取出图片如何直接显示在网页上
热 

C#中从数据库取出图片如何直接显示在网页上
作者:编撰    转贴自:参考    点击数:2248    文章录入: zhaizl

SqlConnection cn=new SqlConnection(conn);
SqlCommand cmd=new SqlCommand();
cmd.CommandText= "select Image from UpImage ";//查询语句
cmd.Connection=cn;
cn.Open();
this.Response.ContentType= "image/jpeg ";
//this.Response.ContentType= "image/bmp ";
//this.Response.ContentType= "image/gif ";
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
this.Response.BinaryWrite((byte[])dr[ "Image "]);//显示图片
}
cn.Close();
  • 上一篇文章: C#正则表达式语法规则

  • 下一篇文章: 给ueditor编辑器赋值
  •   最新5篇热点文章
      最新5篇推荐文章
      相关文章
    ·给ueditor编辑器赋值[501]
    ·远古北半球森林大面积灭绝新解[698]
    ·6月10日《自然》杂志精选[699]
    ·土星卫星热量分布图酷似"吃豆"…[699]
    ·摄影师拍下神奇瑜珈猫 高难度动…[699]
    ·C# Request.ServerVariables2[908]
    ·Request.ServerVariables[910]
    ·html基本标签大全[918]
    ·龙芯3a7000最新进展[929]
    ·deepin 23 已知待修复问题[931]
    ·C#的FOR循环语句[364]
    ·C# for 循环[414]
    ·C# Request.ServerVariables2[908]
    ·浅析C# List实现原理[943]
    ·浅析C# List实现原理[954]
     
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)