如何在pictureBox中读取图像作为流和显示 [英] How to Read Image as Stream and Display in pictureBox

查看:78
本文介绍了如何在pictureBox中读取图像作为流和显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法从数据库中读取图像作为输入流。



System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();

Byte [] imgData =(Byte [])dr [Image]。ToString();







System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();

Byte [] imgData =(Byte [])dr [Image];



无法通过以上陈述完成流程



但是

Byte [] imgData = (Byte [])cmd.ExecuteScaler();



工作正常,,,,,但我是在使用ExecuteReader()

帮我解决这个问题

解决方案

详细参考这个论坛,你可以解决问题。

http://forums.asp.net/t/1824646.aspx [ ^ ]

having trouble to read image as input stream from database.

System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
Byte[] imgData = (Byte[])dr["Image"].ToString();

or

System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();
Byte[] imgData = (Byte[])dr["Image"];

cant get process done through above statements

but
Byte[] imgData = (Byte[])cmd.ExecuteScaler();

works fine,,,,, but i was to be doing using multiple records using ExecuteReader()
Help me out to sort this issue

解决方案

Refer this forum in detail where you can get your problem solved.
http://forums.asp.net/t/1824646.aspx[^]


这篇关于如何在pictureBox中读取图像作为流和显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆