CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2012
    Posts
    6

    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.

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    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.

  3. #3
    Join Date
    Oct 2012
    Posts
    6

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi

    Has to be SIGNED for x64 Systems...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    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.

  6. #6
    Join Date
    Oct 2012
    Posts
    6

    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?

  7. #7
    Join Date
    Oct 2012
    Posts
    6

    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?

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    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)

  10. #10
    Join Date
    Oct 2012
    Posts
    6

    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

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi

    I'd check with ORACLE
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Oct 2012
    Posts
    6

    Re: Problem with running VB6 app in Windows 7(64bit) that had run in Windows XP(32bi

    Check with ORACLE about what?

  13. #13
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    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
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured