我正在尝试使用OleDbConnection从oracle数据库中检索blob数据,但它返回此错误"未指定错误,发生Oracle错误,但无法从Oracle检索错误消息。不支持.Data类型。 #34;我可以检索除了blob之外的其他类型(varchar,number ...)的字段。感谢任何帮助,下面是我的代码:
Dim PictureCol As Integer = 0
Dim DestFilePath = "C:\testBlob.dat"
Dim Conn As New OleDbConnection
Conn.ConnectionString = GetConnectionString()
Conn.Open()
Dim cmd As New OleDbCommand("SELECT d.document_file from library_documents d d.CATEGORY_ID=1 ", Conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
dr.Read()
Dim b(dr.GetBytes(PictureCol, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
dr.GetBytes(PictureCol, 0, b, 0, b.Length)
dr.Close()
Conn.Close()
Dim fs As New System.IO.FileStream(DestFilePath, IO.FileMode.Create, IO.FileAccess.Write)
fs.Write(b, 0, b.Length)
fs.Close()
答案 0 :(得分:0)
使用oraclecommand而不是OleDB解决