I have a software package with it's own dataflex database. I use the Connx ODBC driver to access the database tables in Excel, Access and Delphi.
There is a database table (SYSNUMS) with a single record that stores the next transaction number for different types of transactions, eg. invoice, payment, receipt, etc. Whenever a new invoice is created in the software package, a new record with the number showing in the INVOICE_NO field in SYSNUMS is created in the invoice header table, and then the INVOICE_NO field in SYSNUMS is incremented.
The software package must use locking of some sort, because it won't create duplicate invoice numbers, even though we've got 40+ users using it.
The problem is I want to use a Delphi app to create an invoice, and it must read and increment the INVOICE_NO field, without allowing anyone else to jump in and read or increment it in the middle. That would be disaster.
What should my approach be here? The ODBC driver doesn't support transactions. I'm only vaguely aware of what all the properties of TADOConnection and TADOCommand do.
If I could return the field value from TADOCommand as a result of an UPDATE SQL command, that would be dandy.
There is a database table (SYSNUMS) with a single record that stores the next transaction number for different types of transactions, eg. invoice, payment, receipt, etc. Whenever a new invoice is created in the software package, a new record with the number showing in the INVOICE_NO field in SYSNUMS is created in the invoice header table, and then the INVOICE_NO field in SYSNUMS is incremented.
The software package must use locking of some sort, because it won't create duplicate invoice numbers, even though we've got 40+ users using it.
The problem is I want to use a Delphi app to create an invoice, and it must read and increment the INVOICE_NO field, without allowing anyone else to jump in and read or increment it in the middle. That would be disaster.
What should my approach be here? The ODBC driver doesn't support transactions. I'm only vaguely aware of what all the properties of TADOConnection and TADOCommand do.
If I could return the field value from TADOCommand as a result of an UPDATE SQL command, that would be dandy.