12 个解决方案
#1
把Bolb以二进制数据读到程序里然后使用MemoryStream来转成Image就行了。
byte[] bts = this.getBytes();
MemoryStream stream = new MemoryStream(bts);
Image.FromStream(stream);
byte[] bts = this.getBytes();
MemoryStream stream = new MemoryStream(bts);
Image.FromStream(stream);
#2
那我在数据库中读取的时候用什么语句:
Dim strSql As String = "Select image From Table Where id=" & id
Dim Comm As Command = New Command(dtrSQL,conn)
Comm.ExcuteScalar
运行到最后一句报错:
字段类型无法识别
Dim strSql As String = "Select image From Table Where id=" & id
Dim Comm As Command = New Command(dtrSQL,conn)
Comm.ExcuteScalar
运行到最后一句报错:
字段类型无法识别
#3
hbxtlhx 你讲的方法是不是用DataSet和DataAdapter
#4
使用ExcuteScalar应该是对的。
ExcuteScalar返回类型的类型应该是字节数组,你把返回的转成字节数据看看。
ExcuteScalar返回类型的类型应该是字节数组,你把返回的转成字节数据看看。
#5
好的,我试试先。
#6
我用了这句取值
Dim Pic As IO.Byte =This.GetByte(comm.ExcuteScalar())
但是报错:未声明的名称This
Dim Pic As IO.Byte =This.GetByte(comm.ExcuteScalar())
但是报错:未声明的名称This
#7
This?是Me吗?
#8
我用:Me.This.GetByte(comm.ExcuteScalar())
也不行,报错:为声明的名称:Me
也不行,报错:为声明的名称:Me
#9
有高手能帮我一把!
#10
Dim strConnection As String = System.Configuration.ConfigurationManager.AppSettings("kksb")
Dim Conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(strConnection)
Dim strSQL As String = "select photo from t_veh_matching where picname=" & Request("picname")
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, Conn)
Dim myReader As System.Data.OleDb.OleDbDataReader = comm.ExecuteReader(CommandBehavior.SequentialAccess)
Do While myReader.Read()
' Get the publisher id, which must occur before getting the logo.
Photo = myReader.GetString(0)
以上是我的程序
最后一句报错:指定的转换无效
Dim Conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(strConnection)
Dim strSQL As String = "select photo from t_veh_matching where picname=" & Request("picname")
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, Conn)
Dim myReader As System.Data.OleDb.OleDbDataReader = comm.ExecuteReader(CommandBehavior.SequentialAccess)
Do While myReader.Read()
' Get the publisher id, which must occur before getting the logo.
Photo = myReader.GetString(0)
以上是我的程序
最后一句报错:指定的转换无效
#11
一、me 和 this:me是vb使用的,this是c#使用的。
二、从oracle里读图片你这样操作一下试试:
dim reader As OracleClient.OracleDataReader
dim cmd As New OracleClient.OracleCommand
cmd.CommandText = ("Select image From Table Where id=" & id)
cmd.Connection = (conn)
conn.Open()
cmd.ExecuteNonQuery()
reader = cmd.ExecuteReader()
reader.Read()
com_read.ExecuteNonQuery()
PictureBox1.Show()
PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(reader(0), Byte())))
conn.Close()
你这样试试。
二、从oracle里读图片你这样操作一下试试:
dim reader As OracleClient.OracleDataReader
dim cmd As New OracleClient.OracleCommand
cmd.CommandText = ("Select image From Table Where id=" & id)
cmd.Connection = (conn)
conn.Open()
cmd.ExecuteNonQuery()
reader = cmd.ExecuteReader()
reader.Read()
com_read.ExecuteNonQuery()
PictureBox1.Show()
PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(reader(0), Byte())))
conn.Close()
你这样试试。
#12
com_read.ExecuteNonQuery()
这句中的com_read从哪里来的?
再有:
我用的是VS2005
没有PictureBox控件只有Image和ImageMap控件
用法好像不同
这句中的com_read从哪里来的?
再有:
我用的是VS2005
没有PictureBox控件只有Image和ImageMap控件
用法好像不同
#1
把Bolb以二进制数据读到程序里然后使用MemoryStream来转成Image就行了。
byte[] bts = this.getBytes();
MemoryStream stream = new MemoryStream(bts);
Image.FromStream(stream);
byte[] bts = this.getBytes();
MemoryStream stream = new MemoryStream(bts);
Image.FromStream(stream);
#2
那我在数据库中读取的时候用什么语句:
Dim strSql As String = "Select image From Table Where id=" & id
Dim Comm As Command = New Command(dtrSQL,conn)
Comm.ExcuteScalar
运行到最后一句报错:
字段类型无法识别
Dim strSql As String = "Select image From Table Where id=" & id
Dim Comm As Command = New Command(dtrSQL,conn)
Comm.ExcuteScalar
运行到最后一句报错:
字段类型无法识别
#3
hbxtlhx 你讲的方法是不是用DataSet和DataAdapter
#4
使用ExcuteScalar应该是对的。
ExcuteScalar返回类型的类型应该是字节数组,你把返回的转成字节数据看看。
ExcuteScalar返回类型的类型应该是字节数组,你把返回的转成字节数据看看。
#5
好的,我试试先。
#6
我用了这句取值
Dim Pic As IO.Byte =This.GetByte(comm.ExcuteScalar())
但是报错:未声明的名称This
Dim Pic As IO.Byte =This.GetByte(comm.ExcuteScalar())
但是报错:未声明的名称This
#7
This?是Me吗?
#8
我用:Me.This.GetByte(comm.ExcuteScalar())
也不行,报错:为声明的名称:Me
也不行,报错:为声明的名称:Me
#9
有高手能帮我一把!
#10
Dim strConnection As String = System.Configuration.ConfigurationManager.AppSettings("kksb")
Dim Conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(strConnection)
Dim strSQL As String = "select photo from t_veh_matching where picname=" & Request("picname")
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, Conn)
Dim myReader As System.Data.OleDb.OleDbDataReader = comm.ExecuteReader(CommandBehavior.SequentialAccess)
Do While myReader.Read()
' Get the publisher id, which must occur before getting the logo.
Photo = myReader.GetString(0)
以上是我的程序
最后一句报错:指定的转换无效
Dim Conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(strConnection)
Dim strSQL As String = "select photo from t_veh_matching where picname=" & Request("picname")
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, Conn)
Dim myReader As System.Data.OleDb.OleDbDataReader = comm.ExecuteReader(CommandBehavior.SequentialAccess)
Do While myReader.Read()
' Get the publisher id, which must occur before getting the logo.
Photo = myReader.GetString(0)
以上是我的程序
最后一句报错:指定的转换无效
#11
一、me 和 this:me是vb使用的,this是c#使用的。
二、从oracle里读图片你这样操作一下试试:
dim reader As OracleClient.OracleDataReader
dim cmd As New OracleClient.OracleCommand
cmd.CommandText = ("Select image From Table Where id=" & id)
cmd.Connection = (conn)
conn.Open()
cmd.ExecuteNonQuery()
reader = cmd.ExecuteReader()
reader.Read()
com_read.ExecuteNonQuery()
PictureBox1.Show()
PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(reader(0), Byte())))
conn.Close()
你这样试试。
二、从oracle里读图片你这样操作一下试试:
dim reader As OracleClient.OracleDataReader
dim cmd As New OracleClient.OracleCommand
cmd.CommandText = ("Select image From Table Where id=" & id)
cmd.Connection = (conn)
conn.Open()
cmd.ExecuteNonQuery()
reader = cmd.ExecuteReader()
reader.Read()
com_read.ExecuteNonQuery()
PictureBox1.Show()
PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(reader(0), Byte())))
conn.Close()
你这样试试。
#12
com_read.ExecuteNonQuery()
这句中的com_read从哪里来的?
再有:
我用的是VS2005
没有PictureBox控件只有Image和ImageMap控件
用法好像不同
这句中的com_read从哪里来的?
再有:
我用的是VS2005
没有PictureBox控件只有Image和ImageMap控件
用法好像不同