|
-
May 18th, 2004, 02:30 PM
#1
Thread Starter
Junior Member
checking duplicate values in my database?
Hello,
i've made a programe where i need to add new users, i would like it so that if a user has the same name as someone in mu db, then it will not allow that entry?
Thanks
Homer S
-
May 18th, 2004, 03:25 PM
#2
Fanatic Member
It is of course possible that you could have two users with the same name but...
Run a query against the db for the new user name before you run your insert. If the query comes back with one or more results inform the user that a record already exists.
-
May 18th, 2004, 03:26 PM
#3
Frenzied Member
That's more a database issue than a vb issue. Depending on your db, you could set the name as a primary key (identity in SQL Server, I think), or just disallow duplicate values.
-
May 18th, 2004, 03:31 PM
#4
Fanatic Member
Name as a PK is a bad idea - not really guaranteed to be unique. Doesn't take too big a user list to need two "Smith" entries.
-
May 18th, 2004, 07:30 PM
#5
Frenzied Member
Yeah, but if he disallows duplicates, it works like a primary key anyway.
-
May 18th, 2004, 07:36 PM
#6
PowerPoster
Hi Homer,
I don't see how you can avoid duplicate names. That is why most businesses identify customers by a unique number.
Perhaps you should use an Autonumber column to cross identify your customer names.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 18th, 2004, 08:51 PM
#7
I wonder how many charact
Originally posted by salvelinus
Yeah, but if he disallows duplicates, it works like a primary key anyway.
Yea, but deep down, you know you wouldn't do it that way.
-
May 19th, 2004, 02:58 AM
#8
Member
Yes what you need is IDnumber as the primary key. To filter out you should check their name against their address.
Regards
-
May 19th, 2004, 04:36 AM
#9
PowerPoster
Hi,
"To filter out you should check their name against their address."
This takes great care as any minor difference in entering an address would result in a mismatch. It is easier to check firstly on Surname then (if a match is found) Forename then (if a match is found) second forename etc then (if a match is found) postecode (Zip Codes to the Yanks) and then (if a match is found) house number/name.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
May 19th, 2004, 07:35 AM
#10
Frenzied Member
Originally posted by nemaroller
Yea, but deep down, you know you wouldn't do it that way.
That's true, but I wouldn't disallow duplicate names, either. Maybe in a role playing game, where you don't want two Merlins or something.
-
May 19th, 2004, 10:31 AM
#11
Member
Hello,
Like the guys say if you what to prevent duplicate during data entry you need to create primary key and enforce No duplicates.
But if you what to check your DB for existing Duplicate records try running this Query
Code:
SELECT Value1, Value2 FROM TableName WHERE Value3 IN (SELECT Value3 FROM TableName GROUP BY Value3 HAVING COUNT(*) > 1)
Where Value3 – the field that you think has duplicates
Good luck
-
May 19th, 2004, 01:32 PM
#12
Member
Originally posted by taxes
Hi,
"To filter out you should check their name against their address."
This takes great care as any minor difference in entering an address would result in a mismatch. It is easier to check firstly on Surname then (if a match is found) Forename then (if a match is found) second forename etc then (if a match is found) postecode (Zip Codes to the Yanks) and then (if a match is found) house number/name.
Yes, it's a matter of using the English language and I'm not good at it. However, the thing is, as I did mentioned about using IDnumber.
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
|