G
Guest
Hi all,
my case is I want to get an image from access database and I just know it's "OLE object" field type at access
I also don't know how to insert it into access
here is my code and it just can display a invalid image
try
dim strConn as string
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath
("ERIC_TEST_V05.mdb") & "; Jet OLEDB
atabase Password=123456;"
Dim objConn as New OleDBConnection(strConn)
objConn.Open()
Dim objCmd as New OleDbCommand()
objCmd.Connection = objConn
objCmd.CommandText = "SELECT logo FROM office_profile"
Dim objReader as OleDbDataReader
objReader = objCmd.ExecuteReader
While objReader.Read
'Response.BinaryWrite(objReader("logo") & "<br>")
Dim bindata() As Byte = objReader.GetValue(0)
Response.Clear()
Response.ContentType = "Image/bmp"
Response.BinaryWrite ( bindata )
End While
objConn.close()
catch ex as exception
response.write (ex.tostring())
end try
Please help .
Regards,
Eric Keung
my case is I want to get an image from access database and I just know it's "OLE object" field type at access
I also don't know how to insert it into access
here is my code and it just can display a invalid image
try
dim strConn as string
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & server.mappath
("ERIC_TEST_V05.mdb") & "; Jet OLEDB
Dim objConn as New OleDBConnection(strConn)
objConn.Open()
Dim objCmd as New OleDbCommand()
objCmd.Connection = objConn
objCmd.CommandText = "SELECT logo FROM office_profile"
Dim objReader as OleDbDataReader
objReader = objCmd.ExecuteReader
While objReader.Read
'Response.BinaryWrite(objReader("logo") & "<br>")
Dim bindata() As Byte = objReader.GetValue(0)
Response.Clear()
Response.ContentType = "Image/bmp"
Response.BinaryWrite ( bindata )
End While
objConn.close()
catch ex as exception
response.write (ex.tostring())
end try
Please help .
Regards,
Eric Keung