473,503 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it possible to check which fields were changed?

8 New Member
Hello everyone,
I am wondering if it is possible to check *which* rows were updated when a user edits a field.
This is my problem: I have a list of users and it is important that no usernames are repeated. I have already created a function that checks if the username already exists in the database when a user is intially added. However, I am not sure how I can check if, once the username field is *updated*, if the newly updated field already exists.
Obviously, the same function cannot be used when the user is edited because even when the username fieldname is *not* updated, the result will always be "yes, it already exists".
Hopefully you guys can help me brainstorm a solution, I am stuck at the moment.
Thank you :-)
May 22 '12 #1
4 1685
Dormilich
8,658 Recognized Expert Moderator Expert
the most simple solution is to give the database field a UNIQUE KEY constraint. any attempts to create or modify a value to an already existing value will fail.
May 23 '12 #2
newbie93
8 New Member
Hi, thanks for the suggestion. I ended up simply checking if 1 already exists (as opposed to if 0 exist, as the function for adding a user did)
May 23 '12 #3
Dormilich
8,658 Recognized Expert Moderator Expert
but that leaves you with the problem that should that check be skipped (for whatever reason) you can end up with duplicate names. UNIQUE KEY doesn’t allow duplicate names on DB level.
May 23 '12 #4
newbie93
8 New Member
hmm, yes, you are right. I will take your suggestion. Thank you
May 23 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1865
by: aa | last post by:
Is it possible to enforce changed in php.ini without re-booting (w2k)?
4
3125
by: Silas | last post by:
Hi, I use view to join difference table together for some function. However, when the "real" table fields changed (e.g. add/delete/change field). The view table still use the "old fields". ...
6
1577
by: C L Humphreys | last post by:
Hi, Is it possible for fields in a table to have an effect on the results of a query which does not directly use those fields? To explain, I use this query Select * from addresses where...
2
3336
by: Cassie Pennington | last post by:
Is there a command to spell check fields in Access (probably in the afterupdate event)? Thanks in anticipation Cassie
1
1167
by: jhickers | last post by:
In MS 2003 or 2002 can anyone tell me the simplist way to change color of text in a form or report? I want the values of currency fields changed to red if the amount is >= to $1,000. I am not a...
0
919
by: Trollpower | last post by:
Hello NG, Ive got authentication mode Forms activated in web.config. Now I have also 2 pages. Page 'A' needs role '1' to be accessed while page 'B' needs role '2' to be accessed. When the user...
5
6841
by: mabond | last post by:
Hi Can't believe I've not been able to find the answer to this in the on-line help. I have a CheckedListBox which, via a timer control, is populated with the names of files in a network...
5
2237
by: nex85 | last post by:
Hi, On Yahoo! web hosting, we are able to create subdomains, like: 1. yourplace.me.com 2. myplace.me.com 3. ourplace.me.com as subdomains of a site, e.g., www.me.com
2
1261
by: John | last post by:
Hi Is it possible to identify individual fields changed by a user during editing on a form before or immediately after the form is saved? Thanks Regards
1
1346
by: crazyhouse | last post by:
Ok, so i looked up the information that i needed, but now I see that what i was trying to do was really made for a SQL statement. Here is what happens. I open a form (hidden) with 20+ fields on...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.