Continuously Transaction Number

G

Guest

im developing a web application for intranet solution. it have a transaction
named is "Receipt", two locations are use this. but receipt number should be
continue. who can i do this, please help me
 
R

Roland Dick

Hi Menaka,
im developing a web application for intranet solution. it have a transaction
named is "Receipt", two locations are use this. but receipt number should be
continue. who can i do this, please help me

if I understand you right, you want a web application to issue an
ascending unique number.

You could use an Auto Increment value in the backend database (e.g.
IDENTITY (1,1) in SQL Server), if you use a backend database. If it's
your Primary Key column, you can get the value after the insert with
SCOPE_IDENTITY() (SQL Server again).

Hope this helps,

Roland
 
R

Roland Dick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top