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

C#中从数据库取出图片如何直接显示在网页上
作者:编撰    转贴自:参考    点击数:2282    文章录入: 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编辑器赋值[586]
    ·美国“发现”号宇航员完成最后…[729]
    ·青海共和盆地发现大量古生物化…[729]
    ·共轭亚油酸含量高食物可增加乳…[729]
    ·揭示尿崩症治疗新思路[729]
    ·C# Request.ServerVariables2[980]
    ·Request.ServerVariables[986]
    ·html基本标签大全[997]
    ·龙芯中科将于2024年开始向7nm过…[1007]
    ·龙芯3a7000最新进展[1017]
    ·C#的FOR循环语句[431]
    ·C# for 循环[499]
    ·C# Request.ServerVariables2[980]
    ·浅析C# List实现原理[1022]
    ·C#与JavaScript互相调用[1039]
     
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)