SQL, ADO/OLE-DB programming in PB/DLL and PB/CC 
Author Message
 SQL, ADO/OLE-DB programming in PB/DLL and PB/CC

you will find below a sample showing how to send an SQL request to SQL
Server in a PB/DLL or PB/CC application,
using the new ADO/OLE-DB ActiveX technology. The sample below uses the code
generated by our new
JazzAge ActiveX Factory 2.0 'Client Edition'.

Please visit our Web site ( http://www.*-*-*.com/ ) for more information
about JA 'CE':

Philippe Monteil
JAZZAge Software

$IF %DEF(%pb_dll32)
FUNCTION WinMain (BYVAL CurInst AS LONG,BYVAL PrvInst AS LONG,CmdLine AS
ASCIIZ PTR,BYVAL CmdShow AS LONG) EXPORT AS LONG
$ELSE
FUNCTION PBMain() AS LONG
$ENDIF
  LOCAL pADOConnection AS DWORD
  LOCAL hParameterBlock AS DWORD
  LOCAL ConnectionString AS ASCIIZ*256
  LOCAL SQLRequest AS ASCIIZ*256
  LOCAL pADORecordSet AS DWORD
  LOCAL hRows AS DWORD
  LOCAL icelli AS LONG
  LOCAL icellf AS LONG
  LOCAL jcelli AS LONG
  LOCAL jcellf AS LONG
  LOCAL icell AS LONG
  LOCAL jcell AS LONG
  LOCAL txt AS ASCIIZ*256
  LOCAL vcell AS ASCIIZ*256

 ' Create an ADO Connection ActiveX component
  pADOConnection=JACreateActiveXObject("ADODB.Connection.2.0")

' Open the  ADO Connection, calling the component OPENB method, using
optional parameters
  hParameterBlock=JANewParameterBlock
  ConnectionString="dsn=localserver"
  JAAddParameterToBlock
hParameterBlock,"ConnectionString",ConnectionString,%JAVT_LPSTR
  ADOConnectionOpen pADOConnection,hParameterBlock

 ' Send an SQL request
  SQLRequest="SELECT * FROM CUSTOMERS"
  pADORecordSet=ADOConnectionExecute(pADOConnection,SQLRequest,0)

 ' Obtain the SQL request result
  hrows=ADORecordsetGetRows(pADORecordSet,0)

  icelli=JAGetArrayLBound(hrows,1)
  icellf=JAGetArrayUBound(hrows,1)
  jcelli=JAGetArrayLBound(hrows,2)
  jcellf=JAGetArrayUBound(hrows,2)

 ' Display the content of the request result
  FOR jcell=jcelli TO jcellf
    txt="Row(" + STR$(jcell) +")="
    FOR icell=icelli TO icellf
      JAGet2DArrayCell hrows,icell,jcell,vcell,256,%JAVT_LPSTR
      txt=txt + "-" + vcell
    NEXT icell
    JACDebug txt
  NEXT jcell

  ' Release the rows
  JADeleteVariant hrows

 ' Release the Record Set
  JAReleaseActiveXObject pADORecordSet

 ' Release the Connection
  JAReleaseActiveXObject pADOConnection

END FUNCTION



Fri, 09 Mar 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. MX Lookup with PB/CC or PB/DLL

2. TCPADDR for PB/DLL & PB/CC

3. Info on new PB/CC and PB/DLL

4. Announcing the JazzAge COM Wizard for PB/DLL and PB/CC

5. animated characters, speech input/output in PB/DLL and PB/CC

6. email enable PB/DLL-PB/CC using Outlook

7. PB/CC and SQL-Tools

8. add support for COM and OCXs to PB/DLL-CC

9. add COM components and OCXs support to PB/DLL-CC

10. dir_trav.bas pb/cc 2.11 directory traverse program

11. CGI programming in PB/CC

12. ADO / OLE-DB programming in CW

 

 
Powered by phpBB® Forum Software