Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Getting SQL Tables With CursorAdapter
Message
From
17/11/2003 13:39:40
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Problem Getting SQL Tables With CursorAdapter
Miscellaneous
Thread ID:
00850714
Message ID:
00850714
Views:
60
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
Next
Reply
Map
View

Click here to load this message in the networking platform