(Updated: 2009.10.20 09:33:13 AM)
| |
A new base class introduced in VFP8
Provides access to four different data sources, yet provides the data from these sources as VFP cursors. The data sources include VFP native data (very similar in function to local views), ODBC data (similar to remote views and/or SQL pass through), OLE DB (by using ADO) and XML.
The
Cursor Adapter is not a replacement for any of these technologies; instead, it is most useful at providing a consistent interface to these data sources in the UI of an application. For example, if you have some data stored in SQL Server and other data as XML files, you can access these two different data sources with two separately configured
Cursor Adapter classes. The "presentation" of this data is done via an updatable VFP cursor, allowing you to bind to it in a UI, or process the data using standard VFP commands. --
Chuck Urwiler
Here is some super simple code. (allready exists: mssql, tempdb, table foo )
Get some data.
lodo = CreateObject("CursorAdapter")
lodo.DataSourceType="ODBC"
lodo.DataSource=SQLStringConnect("DRIVER=SQL Server;Network=DBMSSOCN;SERVER=w2kas;database=(local);uid=sa;pwd=")
lodo.SelectCmd="select * from foo"
lodo.CursorFill()
Browse
CursorAdapter VCX Builder for VFP 9 
Mark McCasland
For those looking for some code, take a look at my article at http://www.devx.com/codemag/Article/15699/1954?pf=true
-- Chuck Urwiler
Is there a known issue getting output parameters back from stored procedures when using a very long command? For example, the following works perfectly:
This.InsertCmd = "EXECUTE dbo.REFsp_InsertREFReturnReason @PK_REFReturnReasonID=?@PK_REFReturnReasonID, @ReturnReasonName=?ReturnReasonName"
After using TABLEUPDATE(), the SP creates a record in SQL and passes back the PK as an output parameter - PK_REFReturnReasonID in my cursor is automatically populated with the newly inserted IDENTITY_SCOPE() value from SQL Server.
However, another table has an InsertCmd that is approx 3500 characters long - the stored procedure executes without problems, the new record is inserted, but my field does not get populated from the output parameter. The parameter gets returned correctly when using Query Analyzer, but does not appear to be getting returned to VFP - I've tried returning it to both a variable and straight to the field but both times the value isn't being sent back. If I trim the command down to a few hundred characters then it works again. I've got memowidth set to 8192 and can't see why it refuses to work with a long InsertCmd! Could this be a limitation with the ODBC drivers? I'm using the latest MDAC 2.8 ones. -- Pete Naylor
See also Cursor Adapter Or Not
Category VFP 8 New Features