get unique userid

I am getting a first and last name from the database. now i need to create a userid like lastname and first letter of the first name. I did this. Now i need to check if the userids are unique. If it is not unique i can add a 1 to it. Can anyone help me in this.
[269 byte] By [hectar] at [2007-9-30 17:26:04]
# 1

This is not a simple, here it is kind of thing. It just reuires some code writing.

I would suggest you break it down into smaller tasks.

A check for uniqueness means go compare to all others. It is your choice if you involve sql commands or get them all into code and check.

After you add a 1 then any next match needs to go to index of 2 and so on. You just got to write the code. Try it in smaller logic steps.

Also why does the unique id need to be made from their last name and first initial in the first place?

Martin3 at 2007-7-6 13:48:56 > top of Java-index,Administration Tools,Sun Connection...
# 2
hi,I dont know it is very complicated. look in the tutorial.dannysk http://www.work-at-home-profits.com/mesothelioma/mesothelioma-law-firm/index.htm
sucall389 at 2007-7-6 13:48:57 > top of Java-index,Administration Tools,Sun Connection...
# 3
thats the way the userid should be made with first and last names. i was wondering if anyone knew to use the hashmap to compare different ids.
ashishpande at 2007-7-6 13:48:57 > top of Java-index,Administration Tools,Sun Connection...
# 4
The database design should include a unique primary key and let it take care of this automatically.What is the description of the database table(s) you are working with?
Martin3 at 2007-7-6 13:48:57 > top of Java-index,Administration Tools,Sun Connection...
# 5

This problem can be solved by creating a HashMap and loading all the users from the database into that map. Now you can check if there is one that already exists by hash.keyset.containskey(). The key would be the user id and if one exists add 1 to it like hash.put(userid, new Integer(number)); Keep adding a 1 to this number for more similarities in the map.

achilles78 at 2007-7-6 13:48:57 > top of Java-index,Administration Tools,Sun Connection...