Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

VB 6 Application Problem

432022Oct 29 2004 — edited Jun 7 2005
Hi. I am new to using Oracle in VB applications and I'm having a problem I hope someone can help me with.
We have an application that pulls pictures out of a database and shows them on the screen. This application used to pull them from an SQL server, and it worked fine. We moved the data to an Oracle database, and now I am trying to pull the pictures from there instead. I have the application pulling the pictures, and everything seems to work fine, except for one thing - whenever the user clicks the "X" titlebar icon to close the app, they get the following error:

"The instruction at "0x7c910e03" referenced memory at "0xffffffff". The memory could not be "read"."

We are using the 10g "Instant Client" to get the data. Our machines are Windows XP SP 2.

Here is what I know:

1) If the user does NOT search for a picture, the app will close fine. As soon as a search is done, if they then close the app, the error occurs.
2) Some users have the full Oracle 9 client install due to having an external app that uses it. These machines seem to be able to search and exit with no problem. It only seems to be the stations that use the "Instant Client" that die.
3) I have used the standard "odbc_install.bat" routine that came with the Instant Client ODBC package, and I've also added the TNS registry key and file to resolve the name to the server.

Here is the code that searches for the pictures:

Public Sub getPictureORCL(tempSTUID As String, imageControl As Image)
Dim ADOConn As ADODB.Connection
Dim rsDataFile As ADODB.Recordset
Dim strStream As ADODB.Stream
Dim picSSN As String, SQLStr As String

imageControl.Stretch = True
InitConnection "studata", ADOConn
InitRecordset ADOConn, rsDataFile, "select ssn from studata where wid='" & tempSTUID & "'"
picSSN = rsDataFile.Fields("ssn").value
CloseDB ADOConn, rsDataFile
Set ADOConn = CreateObject("ADODB.Connection")

With ADOConn
.ConnectionString = "UID=<<dbuser>>;PWD=<<dbpwd>>;" + _
"Data Source=OracleGold;" + _
"DBQ=OracleGold;DRIVER={Oracle ODBC Driver};" + _
"FBS=100;CSR=T;DBA=R;LOB=F"
.CursorLocation = adUseClient
.Open
End With

SQLStr = "SELECT PRIMARYKEY, DBD_IMAGE FROM PATRON_FLAT_VIEW, PATRONIMAGES " + _
"Where PATRON_FLAT_VIEW.PATRONID = PATRONIMAGES.PATRONID AND " + _
"PATRON_FLAT_VIEW.PRIMARYKEY='"

Set rsDataFile = CreateObject("ADODB.Recordset")
rsDataFile.Open SQLStr & tempSTUID & "';", ADOConn, , , adOpenKeyset

If rsDataFile.EOF Then
rsDataFile.Close
rsDataFile.Open SQLStr & picSSN & "';", ADOConn, , , adOpenKeyset
End If
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.Write rsDataFile.Fields("DBD_IMAGE").value
strStream.SaveToFile "f:\stuTempPhoto.jpg", adSaveCreateOverWrite
imageControl.Picture = LoadPicture("f:\stuTempPhoto.jpg")
Kill "f:\stuTempPhoto.jpg"
strStream.Close
CloseDB ADOConn, rsDataFile
End Sub

CloseDB is the following procedure:
Public Sub CloseDB(ADOConn As ADODB.Connection, ADORS As ADODB.Recordset)
On Error Resume Next
ADORS.Close
ADOConn.Close
Set ADOConn = Nothing
Set ADORS = Nothing
On Error GoTo 0
End Sub

Thank you for any assistance you can provide!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2005
Added on Oct 29 2004
3 comments
1,004 views