Re: Add SQL Server views to Cursor Adapter

From: Anders Altberg (x_pragma_at_telia.com)
Date: 11/24/04

  • Next message: Ana María Bisbé York: "Re: Add SQL Server views to Cursor Adapter"
    Date: Wed, 24 Nov 2004 21:15:56 +0100
    
    

    Ana
    You can use the views name just like a tablename, In this example it's the
    view "Sales By Category" in the SQL Server demo Northwind database
    *************
    LOCAL lUseCursorSchema, lNoData, nOptions
    STORE .F. to lUseCursorSchema, lNoData
    nOptions = -1
    LOCAL llOk As Boolean, oDB As ADODB.Connection
    PUBLIC oCA as CursorAdapter,oRs As ADODB.Recordset
    oDB = Createobject("ADODB.Connection")

    oDB.ConnectionString = ;
    [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist ;
    Security Info=False;Initial Catalog=Northwind;Data Source=(local)]

    oDB.Open(oDB.ConnectionString)
    oRs=oDB.Execute('select * from "Sales by Category"')
    oCA=Createobject('CursorAdapter')
    oCA.DataSourceType='ADO'
     oca.Alias='Sales by Category'
    llOk= oCA.CursorFill( lUseCursorSchema, lNoData, nOptions, oRS)

    If llOk
     Browse Last &&Nowait
    ELSE
     MESSAGEBOX('No go with '+oRs.DataSource)
    Endif
    *****************

    -Anders

    "Ana María Bisbé York" <ambyNOSPAM@telefonica.net> wrote in message
    news:#xhhTph0EHA.804@TK2MSFTNGP12.phx.gbl...
    > Hi all,
    >
    > My name is Ana Ma. Bisbé. I'm writing you from Madrid, Spain.
    >
    > I'm trying to add some views from a SQL Server Data Base into CA. I'm
    using
    > the CA Builder.
    >
    > In the second tab, Data access I've chosen Build for Select Command, and
    > then I saw that there aren't included views, just tables.
    >
    > How should I do? Is any choice, except typing of course?
    >
    > Best regards,
    >
    > Ana
    > www.amby.net
    > www.PortalFox.com
    >
    >


  • Next message: Ana María Bisbé York: "Re: Add SQL Server views to Cursor Adapter"