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

C#中从数据库取出图片如何直接显示在网页上
作者:编撰    转贴自:参考    点击数:2326    文章录入: 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编辑器赋值[675]
    ·著名心血管外科专家叶世铎教授…[778]
    ·英2岁女孩智商达156成最小智商…[778]
    ·美最新研究:一见钟情可能存在并…[778]
    ·干细胞移植治疗小细胞肺癌无效[778]
    ·C# Request.ServerVariables2[1071]
    ·Request.ServerVariables[1076]
    ·html基本标签大全[1091]
    ·浅析C# List实现原理[1108]
    ·龙芯3a7000最新进展[1111]
    ·C#的FOR循环语句[535]
    ·C# for 循环[597]
    ·C# Request.ServerVariables2[1071]
    ·浅析C# List实现原理[1108]
    ·C#与JavaScript互相调用[1132]
     
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)