mohamad guntur

mohamad guntur

  • NA
  • 40
  • 39.7k

Auto generate PK with date

Nov 27 2012 10:41 PM
my lecture gave me an assignment, and here is the output

http://i48.tinypic.com/2nteqev.jpg

PR0001 --> is the PK which automatically increase when user generate the add button. i.e: PR0002, PR0003, and so on

28-11-2012 --> is the system date in PC, (assume it's a datetime picker below the textbox)

The PK will be reseted monthly

lets say today is 30th November with last PK --> PR0078
if tomorrow is 1st December the PK will reset to --> PR0000


as we see in the ID textbox, would like this:
PR0078-31-11-2012  --> at the end of november (which means the last transaction from 1st November, till 30th November)

PR0000-01-12-2012 --> at the beginning of december (the PK is reseted to PR0000, which means the first transaction in december)


thanks in advance, any help would be appreciated :D