Master Serial Number counter for Transactions ...

simonwar

Member
Joined
Sep 8, 2009
Messages
17
Programming Experience
Beginner
Hi,

I'm creating an application that will READ and WRITE data to several data tables.

Every time I WRITE I would like to log the transaction in a history file and also update the relevant data table with a uniquely serialised entry.

VB.NET:
'set the start point of the serial number
Dim serialnumber As Integer "1000000000"

'then do some stuff, take the serial number (e.g. 10000000000),
'update my data table and history log file
serialnumber += 1

Q. Where do I put this type of code, i.e. that covers the whole system?
Q. Should the variable be PUBLIC ?

I am fairly new to VB so appreciate soft answers, links, experiences, etc. S.
 
Use a database to hold the transactions, and a unique IDENTITY field for the serial number.
 
Yes, but its good practise as far as i am aware that all datatables have unique numbers and they are fed from a master serialnumber generator, or a single source for a serial number.

Its this generation that I am am mostly intrested in, or are you implying that I always WRITE to the history log, which is a single datatable for all transactions and use its ID Field, which is a number generator to send back to use in the the relevant datatable in question ?

See the attachment; is Method B what your thinking, as I was thinking Method A.

?.S.
 

Attachments

  • Serial Numbering Question.doc
    77 KB · Views: 20
It's more like B, but it's not B.

If I read the diagram correctly, you want to log 'transactions' and give each one a unique identity - so your historylog.tbl would therefore be correct.

However, you wouldnt insert transactions into customer name.tbl or sales.tbl - each record in these table would have their own unique identity in some form (it may be unique by account number, for example).

Each unique transaction in the historylog.tbl would then hold the customer account number reference, the sales item etc etc.

Does that help or confuse?
 
Back
Top