Announcement

Collapse
No announcement yet.

ADO - oConnection.Open - Memory Access Violation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADO - oConnection.Open - Memory Access Violation

    The following code produces a "memory access violation" error ONLY in the PBCC debugger immediately AFTER exiting the PBMAIN() function:

    Code:
    #DIM ALL
    #DEBUG DISPLAY
    #DEBUG ERROR ON
    #INCLUDE "WIN32API.INC"
    #INCLUDE "ADODB.INC"
    
    FUNCTION PBMAIN() AS LONG
      LOCAL oConnection AS Int__Connection
      LOCAL vConStr AS VARIANT
      LOCAL vCursorLocation AS VARIANT
      LOCAL vTimeout AS VARIANT
      oConnection = NEWCOM "ADODB.Connection"
      IF ISNOTHING(oConnection) THEN
        EXIT FUNCTION
      END IF
      vConStr = "Provider=MSDAORA.1;Data Source=xxxx.prod;User ID=ADMIN;Password=xxxxx"
      OBJECT LET oConnection.ConnectionString  = vConStr
      vTimeout = 10
      OBJECT LET oConnection.ConnectionTimeout = vTimeout
      vCursorLocation = %adUseClient
      OBJECT LET oConnection.CursorLocation = vCursorLocation
      OBJECT CALL oConnection.Open
      OBJECT CALL oConnection.Close
      oConnection = NOTHING
    END FUNCTION
    Code:
    Exception: Memory Access Violation
    Program tried to read or write an invalid memory address
    When I run the EXE in "run mode" or outside the debugger, no error is triggered. I can even load recordsets and display their contents without error and get the expected results.

    What am I missing? Can anybody please help me?

    Regards
    Heinz Salomon
    Last edited by Heinz Salomon; 26 Feb 2009, 08:12 AM.
Working...
X