Nothing obvious from a quick scan of the code. What does a msgbox say is
actually in objRS("Overwrite")?
What sort of field is "Overwrite"? If it's Boolean, I doubt that "Yes" is
what you should be checking for. If it's Boolean, in JScript I'd just do
'if (objRS("Overwrite"))'.
Dave S
----- Original Message -----
From: professorw999
To: [EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 8:39 AM
Subject: [ASP] Problem Updating Database Record
I realize this is a little quirky, but here goes. I have a basic
script that searches my database table for the users email address.
IF the record does not exist THEN insert a new record. ELSE display
the "email already exists" message. However, I need to throw in one
kink. If the record already exists, but the Overwrite field
= "Yes", the record should be updated.
Below is the base of my script. If the record is found, it keeps
displaying the "email already exists" message. I can't seem to get
the excemption to work based on the Overwrite field. Does someone
see what I am missing?
mySQL = "SELECT * FROM tblProfiles WHERE fEmail = '" & strEmail & "'"
objRS...
objConn...
IF objRS.EOF THEN
objRS.AddNew
...
objRS.Update
ELSEIF objRS("Overwrite") = "Yes" THEN
objRS.MoveFirst
...
objRS.Update
ELSE
Response.Write "Your email already exists in our database."
END IF
Thanks,
PW
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.759 / Virus Database: 508 - Release Date: 9/09/04
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/