字节到图像C#从Web应用程序到Windows应用程序

时间:2019-12-31 06:51:36

标签: c# sql windows vb.net

我有一个Web应用程序,该应用程序上载图像并在SQL中以image -column数据类型image-的形式存储,并且我有一个Windows应用程序,它从SQL db中读取作为数据表并将图像存储在文件夹中。

问题是,当我尝试保存图像时,尽管我使用了writeallbytes,但它给出的格式不受支持。

        byte[] ImagemByte = ObjectToByteArray(DtResult.Rows[0]["BackgroundImageByte"]);
        string filename = "@" + Path.Combine(Conf.BgImagePath + "\\", DtResult.Rows[0]["ThemeId"].ToString() + DtResult.Rows[0]["BackgroundImage"].ToString());
        File.WriteAllBytes(filename, ImagemByte);

0 个答案:

没有答案