PictureBox问题 [英] PictureBox Question
问题描述
我有一个包含图像BLOB字段的表。我想
将图片从
数据库直接复制到一个图片框控件,我已经尝试了以下
:
Dim c as Integer
c = sDataSet.Tables(0).Rows.Count
Dim bytBLOBData()As Byte =
sDataSet.Tables(0).Rows(c-1)(" Image")
Dim stmBLOBData As New System.IO.MemoryStream(bytBLOBData)
我收到错误无效参数用户在以下行之后:
Me.PictureBox2.Image = Image.FromStream(stmBLOBData)
我也尝试更改以下行 - 仍然是无效参数
用户错误。
Dim bytBLOBData()As Byte =
CType(sDataSet.Tables(0).Rows(c-1)(" Image"),Byte() )
请有人给我一个想法,请提前谢谢。
问候。
Hi,
I have a table which contains a BLOB field for image. I would like
to copy a picture from
database directly to a picture box control and I have tried the
following:
Dim c as Integer
c = sDataSet.Tables(0).Rows.Count
Dim bytBLOBData() As Byte =
sDataSet.Tables(0).Rows(c-1)("Image")
Dim stmBLOBData As New System.IO.MemoryStream(bytBLOBData)
I get the error "Invalid Parameter user" after the following line:
Me.PictureBox2.Image = Image.FromStream(stmBLOBData)
I also tried changing the following line - still "Invalid Parameter
user" error.
Dim bytBLOBData() As Byte =
CType(sDataSet.Tables(0).Rows(c-1)("Image"), Byte())
Can anyone give me an idea please, thanks in advance.
Regards.
推荐答案
wandii,
尝试将blob中的数据读入SqlBinary,并使用它来构建你的记忆使用SqlBinarys Value属性流
hth
" wandii"写道:
wandii,
try reading the data from your blob into a SqlBinary, and using this to
contruct your memory stream using the SqlBinarys Value property
hth
"wandii" wrote:
我有一个包含图像BLOB字段的表。我想将
数据库中的图片直接复制到图片框控件中,我已经尝试了以下内容:
Dim c as Integer
c = sDataSet.Tables(0).Rows.Count
Dim bytBLOBData()As Byte =
sDataSet.Tables(0).Rows(c-1)(" Image")
Dim stmBLOBData As New System.IO.MemoryStream(bytBLOBData)
我收到错误Invalid Parameter user在以下行之后:
Me.PictureBox2.Image = Image.FromStream(stmBLOBData)
我也尝试更改以下行 - 仍然是无效参数
用户错误。
Dim bytBLOBData()As Byte =
CType(sDataSet.Tables(0).Rows(c-1)(Image),Byte())
>请有人给我一个想法,请提前谢谢。
问候。
Hi,
I have a table which contains a BLOB field for image. I would like
to copy a picture from
database directly to a picture box control and I have tried the
following:
Dim c as Integer
c = sDataSet.Tables(0).Rows.Count
Dim bytBLOBData() As Byte =
sDataSet.Tables(0).Rows(c-1)("Image")
Dim stmBLOBData As New System.IO.MemoryStream(bytBLOBData)
I get the error "Invalid Parameter user" after the following line:
Me.PictureBox2.Image = Image.FromStream(stmBLOBData)
I also tried changing the following line - still "Invalid Parameter
user" error.
Dim bytBLOBData() As Byte =
CType(sDataSet.Tables(0).Rows(c-1)("Image"), Byte())
Can anyone give me an idea please, thanks in advance.
Regards.
你好,
感谢您的回复。我不熟悉SqlBinary可以
你请给我一个小例子。在此先感谢。
家伙写道:
Hi guy,
Thanks for the reply. I am not familiar with the SqlBinary could
you please give
me a small example on this. Thanks in advance.
guy wrote:
wandii,
尝试将blob中的数据读入SqlBinary,然后使用它来
使用SqlBinarys Value属性构建内存流
wandii,
try reading the data from your blob into a SqlBinary, and using this to
contruct your memory stream using the SqlBinarys Value property
hth
你好,
感谢您的回复。我不熟悉SqlBinary可以
你请给我一个小例子。在此先感谢。
家伙写道:
Hi guy,
Thanks for the reply. I am not familiar with the SqlBinary could
you please give
me a small example on this. Thanks in advance.
guy wrote:
wandii,
尝试将blob中的数据读入SqlBinary,然后使用它来
hth
wandii,
try reading the data from your blob into a SqlBinary, and using this to
contruct your memory stream using the SqlBinarys Value property
hth
这篇关于PictureBox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!