2021-07-29

数据库存64位,读取64位转为二进制,在页面上展示

public void show()
{
   try
   {

  SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]); //链接字符串
  connection.Open();

  StringBuilder sql = new StringBuilder();
  sql.Append("查询的sql");
  SqlCommand comm = new SqlCommand(sql.ToString(), connection);
  SqlDataReader dr = comm.ExecuteReader(CommandBehavior.CloseConnection);

  if (dr.HasRows) //判断
  {

    while (dr.Read())
    {
      Response.Clear();

      Response.BinaryWrite((byte[])dr["Image"]);//读取 

    }

  }

  else
  {//当查询数据不存在时,用暂无图片代替

    string path = System.Environment.CurrentDirectory;//非Web程序
    if (System.Environment.CurrentDirectory != AppDomain.CurrentDomain.BaseDirectory)
    {
      path = AppDomain.CurrentDomain.BaseDirectory;//asp.net 程序
      path += "Images\\without1.gif";
    }
    Response.Clear();
    using (FileStream fs = new FileStream(path, FileMode.Open)){
      byte[] byData = new byte[fs.Length];
      fs.R......

原文转载:http://www.shaoqun.com/a/892355.html

跨境电商:https://www.ikjzd.com/

c-tick认证:https://www.ikjzd.com/w/2074

primc:https://www.ikjzd.com/w/129

stylenanda官网:https://www.ikjzd.com/w/1675.html


publicvoidshow(){try{  SqlConnectionconnection=newSqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);//链接字符串  connection.Open();  StringBuildersql=newSt
汇通天下:https://www.ikjzd.com/w/2055
四姑娘山嘉绒藏族民俗 - :http://www.30bags.com/a/405903.html
四姑娘山嘉绒婚嫁习俗 - :http://www.30bags.com/a/405906.html
四姑娘山交通指南 - :http://www.30bags.com/a/405919.html
四姑娘山景区日隆镇餐馆一览表 - :http://www.30bags.com/a/405929.html
上课忘穿内裤被男同桌摸 上课把女同学玩出水了:http://lady.shaoqun.com/m/a/247770.html
女同桌让我伸进她的裤子里 女同学让我尽情的玩弄她:http://lady.shaoqun.com/m/a/247246.html
老外一个接一个的上 又粗又长我被老外玩晕了:http://lady.shaoqun.com/m/a/247267.html
深圳保利剧院可以现场买票吗:http://www.30bags.com/a/517615.html
深圳世界之窗的铁塔叫什么(名字+比例+图片):http://www.30bags.com/a/517616.html
深圳哪里适合看流星雨(看星星):http://www.30bags.com/a/517617.html
谁不是一边做外贸B2B,一边做B2C呢?:https://www.ikjzd.com/articles/147025

No comments:

Post a Comment