` Printed Icetips Article

Icetips Article



Par2: Using Crystal Reports from Clarion
1999-01-07 -- Joe Suriano
 
We connect to SQL Anywhere using ODBC.   Here's is some code snipets of what
I do.  Maybe something will jump out at you.  One thing I did notice
different is that I must send the database name, userid & password.  HTH.


!***************************************************************************
!-Crystal Report Engine equates
!---- SQL Engine Logon info structures ---------
PE_SF_DESCENDING        equate(0)
PE_SF_ASCENDING         equate(1)
PE_SERVERNAME_LEN       equate(128)
PE_DATABASENAME_LEN     equate(128)
PE_USERID_LEN           equate(128)
PE_PASSWORD_LEN         equate(128)
PE_WORD_LEN             equate(2)

PE_SIZEOF_LOGON_INFO    equate(PE_WORD_LEN+PE_SERVERNAME_LEN+ |
                               PE_DATABASENAME_LEN+PE_USERID_LEN +
PE_PASSWORD_LEN)

PELogOnInfoType      group,TYPE
StructSize              SHORT
ServerName              CSTRING(PE_SERVERNAME_LEN)
DatabaseName            CSTRING(PE_DATABASENAME_LEN)
UserID                  CSTRING(PE_USERID_LEN)
Password                CSTRING(PE_PASSWORD_LEN)
  END

glo:PELogOnInfo         like(PELogOnInfoType), pre(PEL), THREAD

!***************************************************************************
!-Prototype


PESetNthTableLogOnInfo(SHORT,SHORT,*PELogOnInfoType,SHORT),SHORT,RAW,PASCAL,
DLL(DLL_MODE)

!***************************************************************************

SetDBLogOn  ROUTINE
  !-Set server information
  PEL:StructSize   = PE_SIZEOF_LOGON_INFO
  PEL:ServerName   = ''
  PEL:DatabaseName = 'SOSDATA'
  PEL:UserID       = Global:DBLogonID
  PEL:Password     = Global:DBLogonPW
  if not CheckCrystalError(PESetNthTableLogOnInfo(crJobNum, 0,
glo:PELogOnInfo, True), crJobNum, 'PESetNthTableLogOnInfo') then
    do ProcedureFail
  end



Printed November 21, 2024, 7:18 am
This article has been viewed/printed 35215 times.