Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

See if data already exist DBEdit

Status
Not open for further replies.

heydyrtt

Programmer
Dec 12, 2001
63
US
Have DBEdit box which is linked to datasource field ssn. When entering a new person on this form, if they already exist I do not want duplicate record, so after entering a ssn number in DBEdit and onexit I need to check and see if that ssn is already in the table, how do you do this?


Thanks



Heydyrtt
 
Off the top of me head I can think of a couple of ways. One is to have an index on SSN. You can then do a search on the SSN to see if it exists. I suppose you wouldn't have to have an index but it would be faster if you did.

Another is to tell the DB to disallow dups. When you post to the DB, you can use a try...catch statement. The catch statement could catch dbErrors for dup SSNs.

What DB are you using? How you handle this may depend on your DB.



James P. Cottingham

There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top