我有一张将图像作为字节数组存储的表格。我在表中的行迭代和检索字节数组如下如何以编程方式将varbinary列中的图像添加到asp.net页面
byte[] imgArray = (byte[])row[0];
凡行[0]是VARBINARY(MAX)列的值。我曾尝试过类似于
MemoryStream ms = new MemoryStream(imgArray);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
我的问题是如何在我的asp.net页面上显示img对象?
我需要这样做以编程方式,因为行和图片将实时更改。
定义实时?在页面渲染的时候,还是会在页面渲染后改变? – Lloyd
这里的技术:http://stackoverflow.com/a/14935888/394007 ...享受! –
尝试使用http://stackoverflow.com/questions/5629251/c-sharp-outputting-image-to-response-output-stream-giving-gdi-error中的http响应。 – cubitouch