【问题标题】:Retrieve image from Database in winform在winform中从数据库中检索图像
【发布时间】:2018-02-13 19:50:59
【问题描述】:

我想从数据库中检索数据,但我无法检索图像。我已将 TmagePath 数据类型作为 nvarchar

PFB

【问题讨论】:

    标签: winforms


    【解决方案1】:

    首先您必须考虑图像数据库中的数据类型必须是 VarBinary。不如试试这个:

    var filename = ds.Tables[0].Rows[0];
    byte[] getImg = new byte[0];
    getImg = (byte[])filename["WImagepath"];
    MemoryStream stream = new MemoryStream(getImg);
    Picwaiter.Image = Image.FromStream(stream);
    

    也许有用的答案: https://stackoverflow.com/a/29589703/5603115

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-02
      • 1970-01-01
      • 2013-03-20
      • 2014-03-02
      相关资源
      最近更新 更多