There is no such equivalent in VFP.
VFP has something similar to the SQLCommand, but not as an object, just an SQLExec() function, it has a parameter to send over a sql scropt, not just one command. This can obviously be used quite universally, from
Code:
SQLExec(h,"Insert Into sometable (field1, field2,...) values (?foxprovariable1, ?foxprovariable2,...)")
up to
Code:
TEXT TO lcSQL NOSHOW
Declare @tableparameter Table (Value1 as varchar(20), Value2 as varchar(10), Value3 as varchar(30));
Insert Into @tableparameter VALUES ('record','number','one') , ('record','number','two)....
sp_UpdateTable(@tableparameter)
ENDTEXT
SQLExec(h,lcSQL)
If your sp is about updating one single table, then the usual way would be to actually first QUERY records of a table you want to modify into a VFP cursor, make that cursor updatable, modify data, delete records or add records in this VFP cursor, and then do TABLEUPDATE(), which rather works like the entity frameworks Context.SaveChanges(). It is limited to one cursor on the VFP side, but can even update multiple tables, as you can do any query with joins and then map back VFP cursor fields to remote table fields via some properties. The usual case is the simplest "entity model" with a single table.
To create such an updatable VFP cursor you have three ways:
1. SQL passthrough queries combined with CURSORSETPROP you do on the result cursor.
2. Remote views
3. Cursoradapters
Any of these mechanism plus VFPs own way of the SaveChanges method, the TableUpdate() function call, makes up the best practice to act on data. In the same manner VFP handles its native tables, DBF files, for which you don't need to create a cursor, but simply open them with USE.
Only want to insert? Well, your initial query just needs to be WHERE 1=0 and you only append data into the VFP cursor and push this data into SQL Server via the final TableUpdate(). Only want to delete? Well, then you can query all the data you want to delete, delete it in the VFP cursor and then forward all the single DELETE FROM TABLE WHERE id = ? via a TABLEUPDATE(), but in that case rather just send over the DELETE sql command instead of first loading data.
More complex situations, more tables? Well, you do more VFP cursors, the practical limit is your RAM only. Especially with the Cursoradapter base class you can design classes, which you can let reference each other and cascade TABLEUPDATEs of a hierarchy of tables like orders and orderdetails, defining the orderdetail cursoradapterobject as childobject of the orders cursoradapter. VFP also has collections, though don't get the idea you need an object per record, every cursoradapter object maintains a cursor, which by now should be clear, is similar to a C# datatable.
OK, that said this is the top of the iceberg, there's a lot to learn, if you're new to VFP. It's easy to SQLExec a query and let a cursor metarialize without first needing to define any model and context, only prerequisite is a connection you do with SQLStringConnect needing a connection string as major ingredient and resulting in a handle used by SQLExec() and other SQL passthrough functions. Preparing a cursor to write back to SQL is more complex, though in the end it's just a bunch of details you specify: 1. tables, 2. keyfield(s), 3. which fields to update and 4. mapping of VFP cursor fuield names and SQL Server full qualilfied names (table.field). Remote View and Cursor Adapter allow you to define a schema the cursor is pressed into, allowing other types, more precise types than VFP and ODBC infer from the query alone. Without going too far, that mainly means I suggest you concentrate on Cursoradapter as the most complete mechanism to remote data in VFP.
Bye, Olaf.