-
October 30th, 2012, 01:24 PM
#1
Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bit).
I had a VB6 application that was running fine on Windows XP, 32Bit.
I have now migrated it to Windows 7, 64Bit. I have an odbcconf.dll that the
project is looking/referecing for it in the Windows\System32 subdirectory. Should
it not be looking instead in the Windows\sysWOW64 subdirectory. How do
I change the path it is looking for the .dll. How do I determine if it is looking
at the right path.
-
October 31st, 2012, 06:43 PM
#2
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
Did you register the dll?
Always use [code][/code] tags when posting code.
-
November 1st, 2012, 10:38 AM
#3
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
I was given little more information. I have not run the program myself. I was going off info over a month old. The part that is not working is when the program communicates with the database and then remembers that for future communications. It uses the odbc32.dll. The
segment of the code worked for Windows XP, 32Bit but when run on Windows 7, 64bit the program hangs up. Since I have not seen the error, I do not know specifics. Here is the code:
------------------------------------
Option Explicit
Private Declare Function SQLAllocEnv Lib "odbc32.dll" _
(phenv As Long) As Integer
Private Declare Function SQLAllocConnect Lib "odbc32.dll" _
(ByVal henv As Long, phdbc As Long) As Integer
Private Declare Function SQLConnect Lib "odbc32.dll" ( _
ByVal hdbc As Long, ByVal szDSN As String, _
ByVal cbDSN As Integer, ByVal szUID As String, _
ByVal cbUID As Integer, ByVal szAuthStr As String, _
ByVal cbAuthStr As Integer) As Integer
Private Declare Function SQLFreeEnv Lib "odbc32.dll" _
(ByVal henv As Long) As Integer
Private Declare Function SQLFreeConnect Lib "odbc32.dll" _
(ByVal hdbc As Long) As Integer
Private Declare Function SQLError Lib "odbc32.dll" ( _
ByVal henv As Long, ByVal hdbc As Long, ByVal hstmt As Long, _
ByVal szSqlState As String, pfNativeError As Long, _
ByVal szErrorMsg As String, ByVal cbErrorMsgMax As Integer, _
pcbErrorMsg As Integer) As Integer
Private Declare Function SQLDisconnect Lib "odbc32.dll" _
(ByVal hdbc As Long) As Integer
' ************************************************************************************
' ************************************************************************************
' THE FOLLOWING WAS ADDED TO PROVIDE CONNECTION POOLING. MS CASE# SRZ060810001720
' THIS IS FOUND @ www.support.microsoft.com/kb/237844/en-us
' THIS SHOULD TURN ON CONNECTION POOLING, IT WILL ALLOW THE THE PC TO CONNECT
' FASTER BASED ON THE CONNECTION SHOULD ALREADY EXIST.
'
' ************************************************************************************
Const SQL_ATTR_CONNECTION_POOLING = 201
Const SQL_CP_ONE_PER_DRIVER = 1
Const SQL_IS_INTEGER = -6
Const SQL_CP_OFF = 0
Private Declare Function SQLSetEnvAttr Lib "odbc32.dll" ( _
ByVal EnvironmentHandle As Long, _
ByVal EnvAttribute As Long, _
ByVal ValuePtr As Long, _
ByVal StringLength As Long) As Integer
Dim rc As Long
-
November 1st, 2012, 03:02 PM
#4
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
Has to be SIGNED for x64 Systems...
-
November 1st, 2012, 09:25 PM
#5
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
What do you mean by signed for X64 system?
-
November 1st, 2012, 08:50 PM
#6
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
I'll ask again did you register the dll on the windows 7 machine?
Always use [code][/code] tags when posting code.
-
November 1st, 2012, 09:24 PM
#7
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
No I have not tried to register the .dll. Which one, odbc32.dll or odbcconf.dll?
-
November 2nd, 2012, 01:42 AM
#8
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
-
November 2nd, 2012, 01:54 AM
#9
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
It doesn't have to be signed, that is a bit over the top, sorry. Make sure you register your DLL on the 64 bit system, as previously suggested.
Oh, and while I have you one the line ( so to speak ), please look here to find out how to add CODE tags to your code :
http://forums.codeguru.com/showthrea...for-more-info)
-
November 6th, 2012, 11:33 AM
#10
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
After being able to run the code the following error is indicated:
[Microsift][ODBC driver for Oracle][ORACLE]ORA-06413: Connection not open.
This error comes up after the function SQLConnect is performed. It seems everything
else up to that point runs fine. Things were run in this sequence, SQLAllocEnv, SQLAllocConnect,
and then SQLConnect. After the error occurs in SQLConnect, the SQLError is run to get the error
message listed above. SqlState was NA000. So if everything is fine upt to this point what do I
need to look at. see code below.
-------------------------------------------------------------------------------------
Code:
' ***********************************************************************
' THIS IS A MICROSOFT DOWNLOAD TO VERIFY THE LOGIN ONTO A ODBC DATABASE
' ***********************************************************************
Dim henv As Long 'Environment Handle
Dim hdbc As Long 'Connection Handle
Dim iResult As Integer
'Obtain Environment Handle
iResult = SQLAllocEnv(henv)
If iResult <> SQL_SUCCESS Then
IsValidODBCLogin = False
Exit Function
End If
'Obtain Connection Handle
iResult = SQLAllocConnect(henv, hdbc)
If iResult <> SQL_SUCCESS Then
IsValidODBCLogin = False
iResult = SQLFreeEnv(henv)
Exit Function
End If
'Test Connect Parameters
iResult = SQLConnect(hdbc, sDSN, Len(sDSN), sUID, Len(sUID), _
sPWD, Len(sPWD))
If iResult <> SQL_SUCCESS Then
If iResult = SQL_SUCCESS_WITH_INFO Then
'The Connection has been successful, but SQLState Information
'has been returned
'Obtain all the SQLState Information
' If frmOracle.Check1.Value Then ShowSQLErrorInfo hdbc, vbInformation
IsValidODBCLogin = True
Else
'Obtain all the Error Information
' If frmOracle.Check1.Value Then ShowSQLErrorInfo hdbc, vbExclamation
' ***********************************************************************
' THE FOLLOWING COMMAND HAS BEEN REM'D OUT TO PREVENT THE ERROR CODE FROM
' POPPING UP ON THE SCREEN AND REQUIRING AN OPERATOR ACKNOWLEDGEMENT
' ***********************************************************************
' ShowSQLErrorInfo hdbc, vbExclamation
IsValidODBCLogin = False
End If
Else
IsValidODBCLogin = True
End If
' ***********************************************************************
' THE FOLLOWING LINE WAS ADDED FROM A RECOMMENDATION FROM MICROSOFT
' CASE # "SRZ060711002202" E-MAIL SUPPORT Ying Liu
' FROM THE ORIGINAL DOWNLOAD FROM MICROSOFT'S KB, DID NOT HAVE THIS LINE
' IN IT. THIS ITEM IS DELCARED AT THE TOP OF THIS MODULE
' ***********************************************************************
iResult = SQLDisconnect(hdbc)
'Free Connection Handle and Environment Handle
iResult = SQLFreeConnect(hdbc)
iResult = SQLFreeEnv(henv)
End Function
Public Sub ShowSQLErrorInfo(hdbc As Long, iMSGIcon As Integer)
' ***********************************************************************
' THIS IS A MICROSOFT DOWNLOAD TO VERIFY THE LOGIN ONTO A ODBC DATABASE
' ***********************************************************************
Dim iResult As Integer
Dim hstmt As Long
Dim sBuffer1 As String * 16, sBuffer2 As String * 255
Dim lNative As Long, iOutlen As Integer
sBuffer1 = String$(16, 0)
sBuffer2 = String$(256, 0)
Do 'Cycle though all the Errors
iResult = SQLError(0, hdbc, hstmt, sBuffer1, lNative, sBuffer2, _
256, iOutlen)
If iResult = SQL_SUCCESS Then
If iOutlen = 0 Then
MsgBox "Error -- No error information available", _
iMSGIcon, "ODBC Logon"
Else
MsgBox Left$(sBuffer2, iOutlen), iMSGIcon, "ODBC Logon"
End If
End If
Loop Until iResult <> SQL_SUCCESS
End Sub
Public Sub ConnectToOracle()
'frmOracleLoad.Show
'frmOracleLoad.lblOracleLoadConnect.Visible = True
-
November 6th, 2012, 12:47 PM
#11
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
-
November 6th, 2012, 01:33 PM
#12
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
Check with ORACLE about what?
-
November 6th, 2012, 01:37 PM
#13
Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi
[ODBC driver for Oracle] and VB6 problems on Windows x64
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|