Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare Expression always right (SQL & USER) on ASP

Status
Not open for further replies.

najjar

Programmer
Jun 5, 2002
11
US
Whats wrong why the Expression
[[ Request.Form("E_Mail") = E_Mail_Obj("E_MailAdd") ]]
is always True
This is my Code
*******************

<!-- #include file =&quot;globalVariables.asp&quot; -->
<!-- #include file=&quot;globalFunctions.asp&quot; -->
<HTML>
<HEAD> <Title> Informaion </Title> </HEAD>
<BODY bgColor=AntiqueWhite>
<CENTER>
<H2> Journal Users </H2>
Please fill all the information <BR><BR>
<FORM METHOD = &quot;Post&quot;>
<Select Size = 3 Name = &quot;Abri&quot; >
<OPTION> Mr.</OPTION>
<OPTION> Mrs</OPTION>
<OPTION> Miss</OPTION>
</SELECT>
<P>
First Name
<INPUT name = &quot;F_Name&quot; > <P>
* Last Name
<INPUT name = &quot;L_Name&quot; > <P>
Organization Name
<INPUT name = &quot;Org_Name&quot; style=&quot;WIDTH: 233px; HEIGHT: 22px&quot; size=30> <P>
* E-mail Address
<INPUT name = &quot;E_Mail&quot; style=&quot;WIDTH: 334px; HEIGHT: 22px&quot; size=42> <P>
<BR>
<BR>
<INPUT type=&quot;submit&quot; value=&quot;Submit&quot; id=submit1 name=subInfo>
<INPUT type=&quot;reset&quot; value=Reset></P>
<%
dim E_Mail_Obj, Test
set E_Mail_Obj = sqlcommand(&quot;select E_MailAdd from JournalInfo &quot;, OBJCONN)
Test = true
if Request.form(&quot;subInfo&quot;) = &quot;Submit&quot; then
While Not E_Mail_Obj.EOF
If Request.Form(&quot;E_Mail&quot;) = E_Mail_Obj(&quot;E_MailAdd&quot;)
OR (In_Program = &quot;&quot;) Then
Test = False
End If
E_Mail_Obj.MoveNext
wend
If Test = true Then
Set write_data = sqlcommand(&quot;INSERT INTO JournalInfo (Suffix, FirstName, Lastname, Organization, E_mailadd) VALUES('&quot;&Request.Form(&quot;Abri&quot;)&&quot;','&quot;&Request.Form(&quot;F_Name&quot;)&&quot;','&quot;&Request.Form(&quot;L_Name&quot;)&&quot;','&quot;&Request.Form(&quot;Org_Name&quot;)&&quot;','&quot;&Lcase(Request.Form(&quot;E_Mail&quot;))&&quot;')&quot;, OBJCONN)
End If
End If
%>
</CENTER>
</FORM>
</BODY>
</HTML>
 
Two guesses.

1. It isn't actually looping through the recordset, so setting the value of Test to True at the top is carrying through.

2. It isn't finding a matching value in the table, so it can't set the value of test back to false.

Try putting some response.writes into the loop, to see if it is actually executing, and also try setting the default value of Test to false. Then you should know where you error is. The money's gone, the brain is shot.....but the liquor we still got.
 
Thank you
I tryed all of these options
and I tested the [test] every where
every thing is working except this expression
**************
[[ E_Mail_Obj(&quot;E_MailAdd&quot;) = Request.Form(&quot;E_Mail&quot;) ]]
**************
if i entered a null in the E-Mail it won't take it
coz of the second part of the if statement

[[ (Request.Form(&quot;E_Mail&quot;) = &quot;&quot;) ]]

so every thing is working except for that exp.
thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top