|
-
Nov 19th, 2001, 01:28 AM
#1
Thread Starter
New Member
auto number generation for multi user environment
Hi,
My client wants that from 3 different machines sales bill will get generated.Bill no should be prefixed with A,B,C.But these alphabets should not be machine specific.Any machine should be able to generate any alphabet provided no other machine is using that alphabet at that moment of time.
can any 1 give me some idea?
-
Nov 19th, 2001, 01:35 AM
#2
Fanatic Member
Okay are you using clients running on each workstation connecting to a central database??
-
Nov 19th, 2001, 01:41 AM
#3
Addicted Member
i would have done it this way !!
take a seperate new table which just stores the last sequence no... Add one to that no (prefix with 'A' B or C whatever way u require) before inserting into your main table and update this table with the new no....
Anil
-
Nov 19th, 2001, 01:42 AM
#4
Thread Starter
New Member
Yes sir, I am using a central database.And my client machines will connect to tha database via DSN
-
Nov 19th, 2001, 01:47 AM
#5
Fanatic Member
okay create a new table in the db
when each client runs have it generate a random prfix eg "ABC" connect the client to the db and check the table for this prefix
if the prefix is not found add this prefix to the table with the machines name eg the table will have two fields "Prefix" & "Comp Name"
When the client exits have it reconnect to the db and delete its entry
this way every client will have a unique prefix
-
Nov 19th, 2001, 01:49 AM
#6
Thread Starter
New Member
Dear Anil.
I know how to auto generate a number.My problem is that How can I Find out that for a particular machine which alphabet should be prefixed.
There r three machines generating auto bill no.Bill no can start with A,B,C only.If any other machine is using A then no other machine can use A.But can use B or C.How can I keep track that which particular alphabet is free to be used by a particular machine
-
Nov 19th, 2001, 02:06 AM
#7
Addicted Member
Originally posted by kuntal
Dear Anil.
I know how to auto generate a number.My problem is that How can I Find out that for a particular machine which alphabet should be prefixed.
ooops.... maybe i misread ur question in a hurry....
anway...
ok...here it goes...
take one new table..."AB" in one record there...
Whenever no is to be generated check this record, take the first character and update the table after generating like this :
if "AB" then update with "BC"
if "BC" then update with "CA"
if "CA" then update with "AB"
so everytime person generates the no he/she will get the new generated character....
I hope it works for u this time.... (theoritaclly it should)... 
tell me if it does... (makes me happy.... )
Anil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|