Description
Inserts a row in a DataWindow or DataStore. If any columns have default values, the row is initialized with these values before it is displayed.
Applies to
DataWindow type |
Method applies to |
---|---|
PowerBuilder |
DataWindow control, DataWindowChild object, DataStore object |
Syntax
PowerBuilder
long dwcontrol.InsertRow ( long row )
Argument |
Description |
---|---|
dwcontrol |
A reference to a DataWindow control, DataStore, or child DataWindow. |
row |
A value identifying the row before which you want to insert a row. To insert a row at the end, specify 0. |
Return value
Returns the number of the row that was added if it succeeds and -1 if an error occurs.
If any argument's value is null, in PowerBuilder and JavaScript the method returns null. If there is no DataWindow object assigned to the DataWindow control or DataStore, this method returns -1.
Usage
InsertRow simply inserts the row without changing the display or the current row. To scroll to the row and make it the current row, call ScrollToRow. To simply make it the current row, call SetRow.
A newly inserted row (with a status flag of New!) is not included in the modified count until data is entered in the row (its status flag becomes NewModified!).
Examples
This statement inserts an initialized row before row 7 in dw_Employee:
dw_Employee.InsertRow(7)
This example inserts an initialized row after the last row in dw_employee, then scrolls to the row, which makes it current:
long ll_newrow ll_newrow = dw_employee.InsertRow(0) dw_employee.ScrollToRow(ll_newrow)
See also