如何将VBNet代码转换为C#? (ByteToImage
是用户定义函数使用,以字节数组转换成位图C#转换为字节数组
Dim Bytes() As Byte = CType(SQLreader("ImageList"), Byte())
picStudent.Image = jwImage.ByteToImage(Bytes)
我试图
byte[] Bytes = Convert.ToByte(SQLreader("ImageList")); // Error Here
picStudent.Image = jwImage.ByteToImage(Bytes);
,但它会产生一个错误说:Cannot implicitly convert type 'byte' to 'byte[]'
我在做什么是基本上将图像从数据库转换为字节数组并将其显示在图片框上。
是什么类型'SQLReader'? – Oded 2012-02-03 15:38:53
我假设SQLreader是一个DataReader?列“ImageList”是什么类型? – 2012-02-03 15:39:01
'Convert.ToByte()'返回一个'byte'。您需要一种方法将任何类型的'SQLreader(“ImageList”)转换为'byte []'。 – jrummell 2012-02-03 15:39:03