SaveDataEx()


" "

short SaveDataEx(long QueryID, long FirstRow, long FirstCol, long LastRow, long LastCol, 
 Boolean Replace, BSTR TableName, BSTR TableSpaceName, BSTR Comment, long CommitScope, 
 IDispatch* Server)

Description

This function saves the range of rows and columns into the specified table and table space. Call CompleteQuery() prior to calling this function if you have not retrieved row data for the rows that you want to save in the table. If you try to save rows that have not been retrieved from the database, the save will fail. If the table already exists, the new data should have the same number and types of columns as the existing table.

This function operates in a separate unit of work than other API functions and its results are committed automatically. Calling Commit() or Rollback() will have no effect on changes you make using this function.

Parameters

Name Description
QueryID The ID of the query, as returned from InitializeQuery().
FirstRow The first row that you want to include in the save. The value of a first row in a result set is 0.
FirstCol The first column that you want to include in the save. The value of the first column in a result set is 0.
LastRow The last row that you want to include in the save, or a negative one (-1) if all rows are included. The value of the last row in a result set is one less than the total number of rows.
LastCol The last column that you want to include in the save, or a negative one (-1) if all columns are included. The value of the last column in a result set is one less than the total number of columns.
Replace Non-zero indicates that the specified data will replace any existing data in the table. Zero indicates that the specified data will be appended to any existing data in the table.
TableName The name of the table in which the data will be stored. If the table does not exist, it is created.
TableSpaceName The name of the tablespace in which the table exists or will be created. If TableSpaceName is omitted or is an empty string, the default tablespace is used. If you have configured QMF for Windows to always use the default tablespace (see RSR_SDDIFFERENTTS in the description for GetResourceLimit()), this parameter is ignored.
Comment Optionally, a string that specifies a comment for the table in which the data is saved.
CommitScope Optionally, how many rows to insert into the table at a time before committing the unit of work. Specifying zero indicates that all of the rows should be inserted before committing. Specifying 10 (for example), indicates that a commit should be performed after every ten rows are inserted.
Server A pointer to an OLE QMF for Windows server object is created.

Return Value

Return value will be zero if successful or non-zero if unsucessful. If the return value is non-zero, you can call GetLastErrorString(), GetLastErrorType(), GetLastSQLCode(), GetLastSQLError(), or GetLastSQLState() to get additional error information. If the result set is empty or no rows are retrieved from the database, non-zero is returned unless FirstRow = 0 and LastRow = -1. In this case, zero is returned and an empty table is created.