This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Secret code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Secret code" Watch "Secret code" New topic
Author

Secret code

Ola Kesh
Ranch Hand

Joined: Dec 24, 2002
Posts: 40
Hello,
Am trying to generate a secret code for each data that is entered into a datbase (the secret code column is the primary key), pls how can i generate this code, any formular or format?,
i need help.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Frequently, a database sequence is used to generate a unique numeric value for use as a primary key.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

from other threads, I'm assuming your using MSAccess. The 'Sequence' functionality Bear mentioned above can also be accomplished in MSAccess. Just set the column you want as the primary key's data type to 'AutoNumber'. As an autonumber field, you never insert or update values in it. Access does everything for you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Secret code
 
Similar Threads
How to encrypt & decrypt Random DES key with DES?
Who suggested / decided �..
NX: How to add a horizontal scrallbar to a scrollPane?
Enryption with Java
MD5 And SHA In JAVA