Results 1 to 3 of 3

Thread: Checking for similar record

  1. #1
    Join Date
    Aug 2005

    Checking for similar record

    Hi I need to check the table for whether a particular record already exist or not in my code.say Name should be unique.I cant do change in database due to some company policies.
    nsql="insert into Users(Name, Username,Password,Path,status)values('"& name &"','"& u &"','"& p &"','"& path &"','"& "live" &"')"

    rs.Open nsql,con

  2. #2
    Join Date
    Jun 2004
    You'll need to have another query like so...
    SELECT COUNT idField AS count FROM Users WHERE Name = 'bob'
    If rs("count") >= 1 then there is a duplicate.

  3. #3
    Join Date
    Jan 2004
    Melbourne, Australia
    You could also create a trigger that attempts to locate identical records before the new record is inserted. This is a good way to add functionality to your database without actually altering its inner-workings -- and thus breaching your companies policies.

    This is said with the assumption that you have access to MS SQL Server, Oracle, or another complying database.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles