How do I set the value of a field to equal the auto incremented row id on a new record?

How do I set the value of a field to equal the auto incremented row id on a new record?

ChrisLChrisL Posts: 13Questions: 4Answers: 0

Using the latest version of Datatables, and the registered version of Editor, I want to do the following:

When the "New" button is selected to add a row to a table, when the new row is saved to the database, I want to set one of the fields of the row to equal the row ID allocated by the database - which is an auto increment field.

How do I do this please?

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Your best method would be to use a database trigger.

    If that isn't an option then you'll need to use the writeCreate server-side event to get the value and then write it back into the database using another SQL query.

    Allan

Sign In or Register to comment.