By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,365 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,365 IT Pros & Developers. It's quick & easy.

retrieving an image from an access database

P: 2
For reasons best known to our IT department, my department is not allowed to use SQL. Instead we have to use Access. No problem there, except we have a need to store images into a database for security reasons. I have now spent over a day and a half trying to crack this. I know it is something to do with stripping the headers from the image held in the database. I did come across an example in c# on this site, but couldn’t convert that code into vb.net.

My current code behind page looks like this and produces gibberish

Option Strict Off
Imports System
Imports System.Web.UI

Imports System.Data
Imports System.Data.OleDb
Imports System.Configuration


Public Class PublicGuidelineList: Inherits Page

public strImage as string
Public strConnString as String = ConfigurationSettings.AppSettings("ConnectionStrin g")
public objConn as New OleDbConnection(strConnString)

Sub Page_Load(Src As Object, E As EventArgs)
If Not Page.IsPostBack

BindData()
End If
End sub

sub bindData()



strImage = "SELECT * FROM table1 "
objConn.open

' Create & execute OleDbCommand query to return records
dim ocd as OleDBCommand = New oleDbCommand(strImage, objConn)
dim myDataReader as oleDBdatareader

myDataReader=ocd.executereader()


myDataReader.read()

Response.binaryWrite(myDataReader.Item("signature" ))

objConn.close
end sub

end class

If anyone has a snippet, I would be gratefule.
Jul 30 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.