I am using MS Sql Server 2005 as backend. I am having a form with text fields,labels and two buttons Save and Cancel for to adding (insert in db table) new employee information. For empid I want to display next available empid in text field and rest of field should filled by the user and hits save button which adds a new record at the end in table and Cancel button to roll back the data entry.
Here's what I did, 1. At Servoy level I had configured employee table columns empid as Row identity as 'PK' and Sequence type as 'db identity' & 2. Programmatically got the max empid from the database and incremented by 1 which is the next available empid for the new record.
Initially, at DB side I had created empid as auto increment that worked to create a new empid, and for roll back the data entry for new employee, it doesn't worked as no matter we add or roll back insert/add, DB is going to auto increment value. In case of roll back I want DB to roll back auto increment empid by 1. That doesn't worked so switch to get next available empid programmatically ( if need more clarification let me know)
Can anyone help me how to display next available id in text field. Any suggestion is appreciated.