short SaveData(long QueryID, long FirstRow, long FirstCol, long LastRow, long LastCol, BOOLEAN Replace, BSTR TableName, BSTR TableSpaceName, BSTR ServerName, BSTR UserID, BSTR Password, BOOLEAN ForceDialog, [VARIANT Account], [VARIANT Comment], [VARIANT CommitScope])
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. |
ServerName | The name of the database server in which the table is stored. If ServerName is omitted or is an empty string, the server you specify in the call to InitializeServer() is used, and UserID, Password, ForceDialog, and Account are ignored. |
UserID | If you specified a different server in ServerName, UserID is the user ID used for that server. If you do not specify a user ID, QMF for Windows will use the user ID last specified for this server if available, or will display a dialog box if none is available. This parameter is ignored if ServerName is omitted or is an empty string. |
Password | If you specified a different server in ServerName, Password is the password used for that server. If you do not specify a password, QMF for Windows will use the password last specified for this server if available, or will display a dialog box if none is available. This parameter is ignored if ServerName is omitted or is an empty string. |
ForceDialog | If you specified a different server in ServerName, non-zero forces QMF for Windows to display a dialog box prompting for logon information, even if a user ID and password were specified or are otherwise available. Zero indicates that QMF for Windows will display this dialog box only if necessary. This parameter is ignored if ServerName is omitted or is an empty string. |
Account | Optionally, if you selected a different server in ServerName, a string specifying accounting information to pass to that server when connecting. The server may use this information in a job accounting system. This parameter is ignored if ServerName is omitted or is an empty string. |
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. |
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.
Related Tasks