Mark said:
That will work so long as the OP does not mind the possibilty of gaps in
the sequence of receipt numbers:
That's true. By the way, that applies to all solutions with
unsynchronized access I can think of. If gaps are to be avoided, menaka,
you will have to use a mutex or something like that to make sure that
the whole procedure (getting a counter somehow, storing/doing whatever
with the data, incrementing the counter *if successful*) can only be
executed in exactly none or one thread.
As for the somehow... a MAX() on the database comes to mind, a counter
in a file, or even an application variable (which by itself of course
will not persist a shutdown of the server or site, but could be
initialized from the database in the Application_OnStart event). I'm
sure there's heaps of other possibilies as well...
Roland