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

C#中从数据库取出图片如何直接显示在网页上
作者:编撰    转贴自:参考    点击数:2251    文章录入: 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编辑器赋值[504]
    ·白血病新型组合疗法问世[700]
    ·《拯救濒危动植物的故事》书评…[701]
    ·神七伴飞卫星飞百天 中国初步掌…[701]
    ·加压素调控母性行为[701]
    ·C# Request.ServerVariables2[912]
    ·Request.ServerVariables[914]
    ·html基本标签大全[926]
    ·龙芯3a7000最新进展[932]
    ·deepin 23 已知待修复问题[936]
    ·C#的FOR循环语句[368]
    ·C# for 循环[421]
    ·C# Request.ServerVariables2[912]
    ·浅析C# List实现原理[947]
    ·浅析C# List实现原理[959]
     
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)