Re: ADO From Fortran - Opening Recordsets?
From: Jugoslav Dujic (jdujic_at_yahoo.com)
Date: 08/27/04
- Next message: Darren Rockett: "Re: Path/File Access Error >> Bad filename or number >> Currently locked by user Admin on Machine XXX"
- Previous message: Mark J. McGinty: "adFilterPendingRecords when no rows have changed"
- Next in thread: Robin: "Re: ADO From Fortran - Opening Recordsets?"
- Reply: Robin: "Re: ADO From Fortran - Opening Recordsets?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Aug 2004 10:10:56 +0200
Robin wrote:
| Hello everyone,
|
| I am trying to use ADO from Compaq Visual Fortran v6.1. I have
| created a Fortran ADO module with the Fortran Module Wizard and have
| some base code that compiles and links. When running the code, my ADO
| connection and recordset are created without errors. The connection
| opens without errors. But when I try to use the $Recordset_Open
| subroutine, I get an unknown status code (-2147352567).
"Error lookup" CVF utility says it's
-2147352567 = 0x80020009 = "An exception ocurred"
which does not tell much either.
But you're really expecting too much from us poor Fortraneers. I'm
X-posting this to ADO group -- maybe someone could tell you more.
| Does anyone know what I'm doing wrong? The code is below:
|
| program main
| USE DFWIN
| USE DFLIB
| USE TestADO
| USE DFCOM
| USE DFAUTO
| USE DFCOMTY
| USE RTObjs
| implicit none
| C
| C VARIABLES
| INTEGER*4 STATUS
| integer*4 aa
| integer*4 iStatic
| integer*4 iReadOnly
| integer*4 iCmd
| TYPE (VARIANT) :: vBSTR1
| TYPE (VARIANT) :: vCONINT
|
| C INITIALIZE OBJECT POINTERS
| CALL INITOBJECTS()
| C
| C CREATE ADO Connection
| CALL COMINITIALIZE(STATUS)
| CALL COMCREATEOBJECT("ADODB.Connection", ADOConn, status)
| IF(ADOConn.eq.0)then
| write(6,*)"Cannot connect to ADO connection object."
| goto 999
| endif
| c
| c create ADO recordset
| CALL COMCREATEOBJECT("ADODB.Recordset", ADORecSet, status)
| if(ADORecSet.eq.0)then
| write(6,*)"Cannot connect to ADO recordset object."
| goto 999
| endif
| c
| c open ado connection
| call $Connection_Open(ADOConn,"Driver={SQL
| Server};Server=SERVER
| *;Database=DBName;Network=DBMSSOCN;", "User", "password", 0,
| *STATUS)
| c
| c open recordset
| C FIRST SET UP BSTR1 = SQL QUERY
| CALL VariantInit(vBSTR1)
| vBSTR1%VT = VT_BSTR
| bstr1 = ConvertStringToBSTR('SELECT * FROM TableName')
| vBSTR1%VU%PTR_VAL = bstr1
| C NEXT SET UP ADOCONN VARIANT
| CALL VariantInit(vCONINT)
| vCONINT%VT = VT_I4
| vCONINT%VU%LONG_VAL = ADOConn
| C
| iStatic = adOpenStatic
| iReadOnly = adLockReadOnly
| iCmd = adCmdTable
| call $Recordset_Open(ADORecSet, vBSTR1, vCONINT,
| *iStatic, iReadOnly, iCmd, STATUS)
| if(status.ne.adStatusOK)then
| write(6,*)"Can't open recordset",STATUS
| goto 999
| else
| write(6,*)ADORecSet!Teeth
| endif
| 999 read(5,*)aa
| continue
| end
|
| Many thanks in advance!
| Robin
-- Jugoslav ___________ www.geocities.com/jdujic Please reply to the newsgroup. You can find my real e-mail on my home page above.
- Next message: Darren Rockett: "Re: Path/File Access Error >> Bad filename or number >> Currently locked by user Admin on Machine XXX"
- Previous message: Mark J. McGinty: "adFilterPendingRecords when no rows have changed"
- Next in thread: Robin: "Re: ADO From Fortran - Opening Recordsets?"
- Reply: Robin: "Re: ADO From Fortran - Opening Recordsets?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|