Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Very simple question Posted by jzhou on 13 Sept 2002 at 6:52 AM
Hi, I am new in ASP programming. Can anyone tell me how to exit a condition. e.g.
<% 
dim nameFld, pwFld
nameFld=request.form("nameFld")

pwFld=request.form("pwFld")

if nameFld="" then
	response.write("Please enter a user name") &"<br>"
        <!-- I want to exit here--> 
end if

if pwFld="" then
	response.write("Please enter a password") &"<br>"
        <1-- I want to exit here-->
end if

%>
...

Report
Re: Very simple question Posted by chick80 on 13 Sept 2002 at 8:16 AM
You can use else...

:
: <% 
: dim nameFld, pwFld
: nameFld=request.form("nameFld")
: 
: pwFld=request.form("pwFld")
: 
: if nameFld="" then
: 	response.write("Please enter a user name") &""
: else if pwFld="" then
: 	response.write("Please enter a password") &""
: end if
: 
: %>
: ...
: 


nICO



How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.
JOHN KEATS


Report
Re: Very simple question Posted by jzhou on 13 Sept 2002 at 10:01 AM
: You can use else...
:
: :
: : <% 
: : dim nameFld, pwFld
: : nameFld=request.form("nameFld")
: : 
: : pwFld=request.form("pwFld")
: : 
: : if nameFld="" then
: : 	response.write("Please enter a user name") &""
: : else if pwFld="" then
: : 	response.write("Please enter a password") &""
: : end if
: : 
: : %>
: : ...
: : 

:
: nICO
:
:

: How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.
: JOHN KEATS
:
:
:

Thank you. This problem is solved. But I can't connect to the SQL server. I am not sure where I am wrong?
<% 
dim nameFld, pwFld
nameFld=request.form("nameFld")

pwFld=request.form("pwFld")

if nameFld="" then
	response.write("Please enter a user name") &""

elseif pwFld="" then
	response.write("Please enter a password") &""

end if

%>
<%
dim conn, objRds
set conn = server.createobject("ADODB.Connection")
set objRds=Server.CreateObject("adodb.recordset")

conn.Provider ="SQL SERVER"
conn.ConnectionString = "dsn=Vehicle;uid=sa;Pwd=" 
conn.open

%>
<%
strSQL="select * from login where login_name='"&nameFld&"' and login_pw='"&pwFld&"'"
set ojbRds=conn.Execute(strSQL)

if objRds.recordcount=0 then
	Response.Write("Wrong login info.")
end if

%>


Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/vehicleasp/login.asp, line 36




Judy



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.