+ 5
Is anybody know how to genarate the next primary-key number automatically, stored in a data-base on my c# application.????
i want to genarate the next invoice number automatically when my form is loaded..the invoice number is the primary-key of the invoice table in the data-base....is anybody know how to do that????plz helpz........
2 Answers
+ 4
select max(invoice_number) + 1 from invoice
Use that for the next invoice number? it is auto-increment? sorry if I misunderstood you.
+ 1
Another alternative is "SELECT IDENT_CURRENT('tablename')" in SQL SERVER.