AddRow (ODBCResultSet - LotusScript)
Adds a workspace for a new row.
Defined in
Syntax
status = odbcResultSet .AddRow
Return value
status
Boolean.
Usage
The sequence of events is: use AddRow to create an empty (null data) row in the ADDROW workspace; use SetValue to populate the row with data; use UpdateRow to write the row to the data source. If the data source supports transaction model commit and roll-back, changes must be followed by a commit or roll-back. The ADDROW workspace holds exactly one row.
The added row is never actually part of a cached result set. Your current row position is either in the result set or in the added row, depending on the action you take. The initial AddRow positions you at the added row. To switch back to the result set, use CurrentRow, LocateRow, FirstRow, or LastRow. Once inside the result set, you can also use the PrevRow and NextRow methods. To switch back to the added row, use the special constant, DB_ADDROW, as in
res.CurrentRow = DB_ADDROW
The PrevRow and NextRow methods work in the result set but cannot be used in the added row.
To determine on which row and on which buffer you are currently located, test CurrentRow for the DB_ADDROW constant.
A successful UpdateRow closes the AddRow workspace and sets CurrentRow back to a row in the result set, if any. When the AddRow workspace is closed, you cannot set the CurrentRow to DB_ADDROW; you must issue another AddRow to open a new AddRow workspace. UpdateRow sends the update to the data source but does not update the result set; to see new rows, re-execute the SQL query. Execute and Close both discard an open AddRow workspace.
If you query the table with an explicit column list (for example, "SELECT Col1, Col2, Col4 FROM Table1"), that list must include all columns for which null values are disallowed; all columns not listed take a null value when the new row is inserted.
Errors
The previous added row has not been updated (DBstsAHVR)
Read only. Data cannot be updated or deleted (DBstsRDON)
Never executed successfully or result set closed (DBstsNOEX)
Events
BeforeAddRow
AfterAddRow
Language cross-reference
EditTableInsertRowColumn @Command in formula language