contents   index   previous   next

Cursor insertRow()




number - 0 if the call was successful; otherwise, a nonzero status code based on the error message produced by the database. If the method returns a nonzero status code, use the associated Database's majorErrorCode and majorErrorMessage methods to interpret the meaning of the error.



This function, only available on undatable cursors, inserts a row into the associated database table. The location of the inserted row may vary depending on the database vendor's implementation, and thus row ordering is not guaranteed. There are several ways to specify values for the row being inserted:


Explicitly assigning values to each column in the cursor and then calling insertRow.


Choosing to a row using the next or previous methods, changing the values of some of the columns and then calling insertRow. Columns that were not explicitly assigned values will receive values from that initially chosen row.


Do not choose a row with next or previous and call insertRow. Since there is no current row in this case, all of the columns for the new row will be null.


Any columns in the cursor that contain unassigned values when insertRow is called will be null in the new row.



#link <sedbc>, Cursor next(), Cursor previous(), Database commitTransaction(), Database rollbackTransaction()



// assume 'database' is a valid Database object

var curs = database.table("customer");


// choose the first row to act as a "template"

// for the new row;


// plug in some values for the new row

curs.Name = "Fred Flintstone";

curs.City = "Bedrock";


// add the row to the database

err = curs.insertRow();



Cursor last()