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" &"')"
You'll need to have another query like so...
If rs("count") >= 1 then there is a duplicate.
SELECT COUNT idField AS count FROM Users WHERE Name = 'bob'
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)