wwsql::InsertDataFromCursor

Imports data from a Fox cursor into a matching SQL table, provided the structures match and data types are compatible.

o.InsertDataFromCursor(lcTable)

Return Value

.T. or .F. Check cErrorMsg for error info.

Parameters

lcTable
Name of the SQL Server table to insert to. If omitted the ALIAS() is used.

Remarks

The structures must be identical and field types must be compatible. If fields are omitted and NULL values aren't supported by the server errors will be generated. If the SQL table is missing fields the Fox table has you can use a SQL SELECT statement to filter the fieldlist before import and run against the VFP cursor.

You can also use cSkipFieldsForUpdates to filter out any fields you don't want to send to the server.

Code actually SCANs the Fox table and builds a dynamic INSERT statement for each record to update the SQL database. Data is always INSERTed.

Example

use wwmb_lookups

loSQL = CREATE("wwSQL")
loSQL.Connect("driver={sql server};server=(local);database=wwMsgTest;uid=sa;pwd=;")

loSQL.InsertDataFromCursor("wwmb_lookups")

See also:

Class wwsql

© West Wind Technologies, 1996-2018 • Updated: 03/02/17
Comment or report problem with topic