wwDotNetBridge::CursorToDataSet

Creates a .NET DataSet from a single or multiple open FoxPro cursors.

DO wwDotNetBridge

CREATE CURSOR TQuery ( Name c(50), Entered T)
INSERT INTO TQUery VALUES ("Rick",DATETIME())
INSERT INTO TQUery VALUES ("Joe",DATETIME())
INSERT INTO TQUery VALUES ("Markus",DATETIME())

CREATE CURSOR TQuery2 ( Name c(50), Entered T)
INSERT INTO TQUery2 VALUES ("Rick",DATETIME())
INSERT INTO TQUery2 VALUES ("Markus",DATETIME())

LOCAL loBridge as wwDotNetBridge
loBridge = CREATEOBJECT("wwDotNetBridge")

*** Pass the two cursors
loDataSet = loBridge.CursorToDataSet("TQuery,TQuery2")
? loDataSet.DataSetName

*** Tables object is a collection not directly accessible thru COM
? loBridge.GetPropertyEx(loDataSet,"Tables.Count")  &&  2

? loBridge.GetPropertyEx(loDataSet,'Tables[0].Rows.Count')   && 3
? loBridge.GetPropertyEx(loDataSet,'Tables["TQuery2"].Rows.Count')  && 2

Manipulation of .NET DataSet objects in VFP is difficult because the internal types are not readily accessible through direct COM interaction - hence the GetPropertyEx calls in the examples above.

The most common scenario for creating DataSets in Fox code is to pass a DataSet to .NET as a parameter.

o.CursorToDataSet(lcAliasList)

Return Value

A .NET DataSet

Parameters

lcAliasList
A comma delimited list of open FoxPro cursors that are to be loaded into the .NET dataset.


See also:

Class wwDotNetBridge

© West Wind Technologies, 2004-2020 • Updated: 06/07/17
Comment or report problem with topic