注册 登录
编程论坛 VB.NET论坛

怎样读取oracle数据库中的blob字段并显示在Image上

zhlxh1201 发布于 2007-09-11 16:46, 4189 次点击
怎样读取oracle数据库中的blob字段并显示在Image上
12 回复
#2
zhlxh12012007-09-11 16:53
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)
以上是我的程序
红色一句报错:指定的转换无效
#3
bygg2007-09-11 19:12
你的Photo是什么类型啊?
myReader.GetString(0) 这个取出来是string型的
#4
zhlxh12012007-09-12 08:45

是blob类型的

#5
zhlxh12012007-09-12 08:46
我是不是改用GetByte来取值
#6
bygg2007-09-12 10:20
#7
zhlxh12012007-09-12 12:34
我使用BS方式编写的
程序代码与你给的有点出入
由于我是新手
请指点
#8
zhlxh12012007-09-12 15:54
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 de As System.Data.OleDb.OleDbDataReader
dr = comm.ExcuteScalar()
#9
bygg2007-09-12 20:08

用DataReader取值..再用BTYE的形式转成Image,

#10
zhlxh12012008-01-15 15:55
???
怎么办?
#11
zhlxh12012008-01-18 11:21
???
咋就没人理我呢?
#12
fairy42008-01-18 12:04
人家都給你相似的詳細代碼!還要怎么幫你?????????
按照你的所有詳細要求,幫你完成你的工作????
#13
bygg2008-01-18 12:32
Dim data() As Byte = ds.Tables("employees").Rows(9)("photo")
Dim stmphoto As New MemoryStream(data)
PictureBox1.Image = Image.FromStream(stmphoto)

这是我给的链接网页中的三句,这个你能看懂吧?
那你就成功了。
1