Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem Getting SQL Tables With CursorAdapter
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00850714
Message ID:
00851089
Views:
13
Hi Brian,

> LOCAL loSchemaRS as ADODB.Recordset

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.
2) Doesn't the recordset identifier have to be the *fifth* argument, not the fourth, in the CursorFill() statement?


>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
>
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform