XSharpPublic
XSharpPublic copied to clipboard
Request - New Function: CreateWorkAreaFromDataTable(oTable, cAlias)
Request: A new Function that will create a Work Area
from a DataTable
.
The reason for this request is when we get a DataTable
from ADO.Net
Sql Server calls, we may want to use our favorite XBase commands like Scan
, Locate
, Append
, Replace
, etc to work on the data, in a Work Area manner for data processing, report generation, save to DBF, etc.
The would create a Work Area
from a DataTable
, with all the same exact features that we'd have if we opened the Work Area from a DBF with the USE
command.
Of course, the data structure of the created Work Area must match the field names and data types of the source Data Table.
This would closely match the existing functionality of the VFP SqlExec()
Function which runs a SQL query string against a database server (Sql Server, MySQL) and returns a (disconnected) VFP Cursor
. If DB updates we then issue Sql UPDATE
calls via SqlExec()
to update Sql Server, but that is not in the scope of this new function. We already have VFP code libraries to generate Sql Server Update commands from a local VFP Cursor.
This might also merit another Function named CreateDataTableFromWorkArea(), but that is not in the scope of this request.