ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 2nd, 2005, 04:53 PM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
Angry checking values in database

Hello,

I'm having a problem in comparing the values, which I'm passing to the action page.

My condition is I'll have to check for the values which I'm passing to the action page to the values in the database.

when I'm comparing I'm getting only the first row in the database and I'll have to run a loop to check the exact values and display a error message."data already exit and ..."

any body help me out how to run a loop query to check the values from the form passed in the action page?

your help would be highly appreciated.

Thanks

Reply With Quote
  #2  
Old February 2nd, 2005, 09:13 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
I don't understand what you're asking.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 3rd, 2005, 06:02 AM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
checking values

I'm passing three form variables values to the action page.In the action page before inserting into the database, it should check for the existance of the values in there or not in the database.If so it should throw an error and if not it should allow to insert.

How to check the values with the database whether existing or not with the values?

Thanks

Reply With Quote
  #4  
Old February 3rd, 2005, 07:37 AM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
Some more details about your db/ would help a bit. But lets say for example your db has one field (name). If you change your db so that the name field is required unique, and you do an insert inside a cftry/cfcatch block, that should work. Another option would be to query all the names in the db (before you do the insert), convert it to a valuelist, and then make sure that list does not contain form.name before doing the insert.

listONames=valuelist(myNameQuery.name);
If (Not(ListFindNoCase(listONames,form.name)))
..... insert new name

hth

Reply With Quote
  #5  
Old February 3rd, 2005, 08:49 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
This should really be handled by the database itself using a constraint. If you try to insert another record that duplicates one that is already in the database, it will throw a "unique contstraint violation" error, which you could catch and at that point you would know that there is already a record in the database.

But if you don't want to take that route, the only way to do it is to query the database, check that there aren't already duplicate records, and only then do the insert.

Reply With Quote
  #6  
Old February 4th, 2005, 08:53 PM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
checking values

I did get that point checking in the database and throw an error.

Thanks guys for your valued tips and time.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > checking values in database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT