Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Getting SQL Tables With CursorAdapter
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00850714
Message ID:
00851107
Vues:
10
Hi Evan,

Two ideas:
>1) I don't think your LOCAL declaration can use the "AS ADODB.Recordset" qualifier. I believe that qualifier must be a VFP datatype, a class name, or something with a type library.

Actually, that's mostly there for Intellisense, which recognizes it since I have it registered. A RS is created and returned without a problem by goConn.OpenSchema() during execution. Adding
loSchemaRS = CREATEOBJECT("ADODB.Recordset")
before calling OpenSchema() doesn't seem to make a difference.


2) Doesn't the recordset identifier have to be the *fifth* argument, not the fourth, in the CursorFill() statement?

Humm... Help only shows four parameters.
CursorAdapter.CursorFill( [ lUseCursorSchema [, lNoData [, nOptions [, Source ] ] ] ] )
I have a generic function that coverts any other RS to a cursor via a CA without any problem... except for the RS returned by OpenSchema that is... I've even tried changing the nOptions flag to -1 and it doesn't make a difference.



- Brian


>
>>Hello,
>>
>>Does anyone know why trying to get a cursor of SQL Server tables using oConn.OpenSchema would fail when using an ADO CursorAdapter? The following returns a "Data type mismatch" when calling CursorFill()...
>>
>>Thanks,
>>
>>- Brian
>>
>>
>>
>>
>>    lcConnString = 'Provider=SQLOLEDB.1;' ;
>>                 + 'Persist Security Info=False;' ;
>>                 + 'Integrated Security=SSPI;' ;
>>                 + 'Initial Catalog=Northwind;' ;
>>                 + 'Data Source=(local)'
>>
>>    * Make an OLEDB connection
>>    goConn = CREATEOBJECT("ADODB.Connection")
>>    goConn.ConnectionString = lcConnString
>>    goConn.ConnectionTimeout = 30
>>
>>    * Make sure cursors are client-side
>>    goConn.CursorLocation = 3  && adUseClient
>>    goConn.Open()
>>
>>    LOCAL ARRAY laADCRIT[4]
>>    LOCAL loSchemaRS as ADODB.Recordset
>>    #DEFINE adSchemaTables 20
>>
>>    laADCRIT    = .NULL.
>>    laADCRIT[4] = "TABLE"
>>
>>    loSchemaRS  = goConn.OpenSchema(adSchemaTables, @laADCRIT)
>>
>>    loCA = CREATEOBJECT("CursorAdapter")
>>    loCA.Alias           = "csrSQLTbls"
>>    loCA.DataSourceType  = "ADO"
>>    loCA.DataSource      = loSchemaRS
>>    loCA.BufferModeOverride = 5
>>    lbOk = loCA.CursorFill( .F., .F., 0, loSchemaRS )
>>    IF NOT lbOk
>>        AERROR(laErr)
>>        MESSAGEBOX("Error: " + TRANSFORM(laErr[1,2]))
>>    ENDIF
>>
>>    loCA.CursorDetach()
>>
>>    IF USED("csrSQLTbls")
>>        BROWSE FIELDS table_name
>>    ENDIF
>>


VFP6 SP5, VFP8 SP1, VFP 9 SP 1 and Win XP SP 3 (unless otherwise specified)


www.wulfsden.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform