Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: two questions help is needed


Message #1 by nusrat sarwar <nusratsarwar@y...> on Mon, 18 Mar 2002 11:59:31 -0800 (PST)
Hi all 
hope all are fine and well
I will be very thankful again if you people solve my
two lousy problems

one is that I want to have item id in list box
but I am unsuccessful in doing so I dont know why?
how can I do like this??

<option value=<%=rs("id")%><%=rs("id")%></option>

but its not working.

secondly I wanna give 4 condition in my login asp
but the "if else"  statment only fulfilling 2 options

I wanna do like this
user=request.form("username")
psw=request.form("password")

select username from users where username='"&user&"'
and password='"&psw&"' 

usern=rs("username")
pss=rs("password")

if rs.eof then

response.write "you are not our member sign in"

elseif  not rs.eof then

response.write "loggin successful"

elseif psw!=pss then

response.write "your password is wrong try again"

else

response.write "username is wrong try again"

end if


so my friends I am not getting desired results
only  2 conditions are working

and getting error at " != " 

please help me as you did before

many thanx 
take care 
regards
nusrat


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #2 by "Debreceni, David" <Debreceni.David@h...> on Mon, 18 Mar 2002 15:04:57 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1CEB8.2D8D64F0
Content-Type: text/plain;
	charset="iso-8859-1"

The first one looks like it is just a typo. try
<option value="<%=rs("id")%>"><%=rs("id")%></option>

and in asp it is <> for not equals.  != is used in jscript or javascript.
Hope that helps

dave

-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Monday, March 18, 2002 15:00
To: ASP Web HowTo
Subject: [asp_web_howto] two questions help is needed


Hi all 
hope all are fine and well
I will be very thankful again if you people solve my
two lousy problems

one is that I want to have item id in list box
but I am unsuccessful in doing so I dont know why?
how can I do like this??

<option value=<%=rs("id")%><%=rs("id")%></option>

but its not working.

secondly I wanna give 4 condition in my login asp
but the "if else"  statment only fulfilling 2 options

I wanna do like this
user=request.form("username")
psw=request.form("password")

select username from users where username='"&user&"'
and password='"&psw&"' 

usern=rs("username")
pss=rs("password")

if rs.eof then

response.write "you are not our member sign in"

elseif  not rs.eof then

response.write "loggin successful"

elseif psw!=pss then

response.write "your password is wrong try again"

else

response.write "username is wrong try again"

end if


so my friends I am not getting desired results
only  2 conditions are working

and getting error at " != " 

please help me as you did before

many thanx 
take care 
regards
nusrat


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/


Message #3 by nusrat sarwar <nusratsarwar@y...> on Mon, 18 Mar 2002 12:13:39 -0800 (PST)
Hi all 
hope all of you are fine and well

I have two queries now
I wanna have item id in a list box but its not doing
properly

i did like it

<option value=<%=rs("id")%>><%=rs("id")%></option>

what should i do to get id in list box successfuly
secondly I wanna give 4 conditions in my login.asp
but only 2 conditions are working

i did like this

psw=request.form("password")
user=request.form("user")

select username, password from users where
username='"&user&"' and password='"&psw&"'

ps=rs("password")
usr=rs("username")

if rs.eof then
response.write "you are not member sign in"
elseif not rs.eof then
response.write "successful login"
elseif ps!=psw then 
response.write "your password is wrong try again"
else
response.write" username is incorrect login again"
end if

it giving error at " != "
and if  I even give 3 conditions it only fulfills 2

so friends ,please do help me as you did before
many thanx
take care
regards
nusrat




__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #4 by nusrat sarwar <nusratsarwar@y...> on Mon, 18 Mar 2002 12:17:14 -0800 (PST)
thanx David
but I tried <> as well
but not got my desired result
any other idea?????????
take care
nusrat

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #5 by "Debreceni, David" <Debreceni.David@h...> on Mon, 18 Mar 2002 15:36:05 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1CEBC.86D2A5D0
Content-Type: text/plain;
	charset="iso-8859-1"

Your query checks for a matching username and password, so you will never
get the the third criterea of your if statement.  If the password does not
match the username then you will get a eof.  Take the "and Password..."  out
of the sql ans see if that works the way you want it to.  
Just food for thought, I was always taught to never tell the user that the
password was incorrect, rather just display a note telling them that the
username or password was incorrect.  This way a hacker never knows if they
have a valid user name or not.  It may not matter, but that is what I was
taught.  hope that helps.

Dave

-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Monday, March 18, 2002 15:17
To: ASP Web HowTo
Subject: [asp_web_howto] RE: two questions help is needed


thanx David
but I tried <> as well
but not got my desired result
any other idea?????????
take care
nusrat

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/


Message #6 by "Chris R. Thompson" <cthompson@n...> on Mon, 18 Mar 2002 16:48:26 -0700
Change:
<option value=3D<%=3Drs("id")%>><%=3Drs("id")%></option>

to this:
<option value=3D'<%=3Drs("id")%>'><%=3Drs("id")%></option>

This may be your problem

With the second, " ps!=3Dpsw" is a javascript way of writing it and 
won't
work in ASP.  Write it like this: " ps <> psw " or like this " Not ps 
=3D
psw "

Thanks,

Chris Thompson



-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Monday, March 18, 2002 1:14 PM
To: ASP Web HowTo
Subject: [asp_web_howto] two questions help is needed

Hi all
hope all of you are fine and well

I have two queries now
I wanna have item id in a list box but its not doing
properly

i did like it

<option value=3D<%=3Drs("id")%>><%=3Drs("id")%></option>

what should i do to get id in list box successfuly
secondly I wanna give 4 conditions in my login.asp
but only 2 conditions are working

i did like this

psw=3Drequest.form("password")
user=3Drequest.form("user")

select username, password from users where
username=3D'"&user&"' and password=3D'"&psw&"'

ps=3Drs("password")
usr=3Drs("username")

if rs.eof then
response.write "you are not member sign in"
elseif not rs.eof then
response.write "successful login"
elseif ps!=3Dpsw then
response.write "your password is wrong try again"
else
response.write" username is incorrect login again"
end if

it giving error at " !=3D "
and if  I even give 3 conditions it only fulfills 2

so friends ,please do help me as you did before
many thanx
take care
regards
nusrat




__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

Message #7 by nusrat sarwar <nusratsarwar@y...> on Wed, 20 Mar 2002 05:58:10 -0800 (PST)
Hi David
Thanx for advise 
my clients wanted that 
but now I think I better convince them not to have
these choices
God bless you
but David the first query still bothering
I have tried both ' ' and " "
<option value="<%=rs("id")%>"><%=rs("id")%></option>
and
<option value='<%=rs("id")%>'><%=rs("id")%></option>
but list not showing /picking values from DB
I dont know what I should do 
I am stuck
many thanx for yr concern and time

take care
regards
nusrat


--- "Debreceni, David" <Debreceni.David@h...>
wrote:
> Your query checks for a matching username and
> password, so you will never
> get the the third criterea of your if statement.  If
> the password does not
> match the username then you will get a eof.  Take
> the "and Password..."  out
> of the sql ans see if that works the way you want it
> to.  
> Just food for thought, I was always taught to never
> tell the user that the
> password was incorrect, rather just display a note
> telling them that the
> username or password was incorrect.  This way a
> hacker never knows if they
> have a valid user name or not.  It may not matter,
> but that is what I was
> taught.  hope that helps.
> 
> Dave
> 
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: Monday, March 18, 2002 15:17
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: two questions help is
> needed
> 
> 
> thanx David
> but I tried <> as well
> but not got my desired result
> any other idea?????????
> take care
> nusrat
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #8 by "TomMallard" <mallard@s...> on Wed, 20 Mar 2002 06:10:28 -0800
Sounds like you have single or double quotes in the data values. Those need
to be doubled or use a backslash escape.

tom mallard
seattle
-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Wednesday, March 20, 2002 5:58 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: two questions help is needed


Hi David
Thanx for advise
my clients wanted that
but now I think I better convince them not to have
these choices
God bless you
but David the first query still bothering
I have tried both ' ' and " "
<option value="<%=rs("id")%>"><%=rs("id")%></option>
and
<option value='<%=rs("id")%>'><%=rs("id")%></option>
but list not showing /picking values from DB
I dont know what I should do
I am stuck
many thanx for yr concern and time

take care
regards
nusrat


--- "Debreceni, David" <Debreceni.David@h...>
wrote:
> Your query checks for a matching username and
> password, so you will never
> get the the third criterea of your if statement.  If
> the password does not
> match the username then you will get a eof.  Take
> the "and Password..."  out
> of the sql ans see if that works the way you want it
> to.
> Just food for thought, I was always taught to never
> tell the user that the
> password was incorrect, rather just display a note
> telling them that the
> username or password was incorrect.  This way a
> hacker never knows if they
> have a valid user name or not.  It may not matter,
> but that is what I was
> taught.  hope that helps.
>
> Dave
>
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: Monday, March 18, 2002 15:17
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: two questions help is
> needed
>
>
> thanx David
> but I tried <> as well
> but not got my desired result
> any other idea?????????
> take care
> nusrat
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
>
>
>
>


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/


Message #9 by "Debreceni, David" <Debreceni.David@h...> on Wed, 20 Mar 2002 11:11:11 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1D029.DA112DC0
Content-Type: text/plain;
	charset="iso-8859-1"


can you out put those values just for printing with out a problem?

ie response.write rs("id")

Are the values just not showing up in the select box?  Can you post some
more of your code so we can see what exactly you are doing?  Your not
hitting an EOF for the recordset are you?  Not really sure at this point.
Thanks

Dave
-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Wednesday, March 20, 2002 8:58 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: two questions help is needed


Hi David
Thanx for advise 
my clients wanted that 
but now I think I better convince them not to have
these choices
God bless you
but David the first query still bothering
I have tried both ' ' and " "
<option value="<%=rs("id")%>"><%=rs("id")%></option>
and
<option value='<%=rs("id")%>'><%=rs("id")%></option>
but list not showing /picking values from DB
I dont know what I should do 
I am stuck
many thanx for yr concern and time

take care
regards
nusrat


--- "Debreceni, David" <Debreceni.David@h...>
wrote:
> Your query checks for a matching username and
> password, so you will never
> get the the third criterea of your if statement.  If
> the password does not
> match the username then you will get a eof.  Take
> the "and Password..."  out
> of the sql ans see if that works the way you want it
> to.  
> Just food for thought, I was always taught to never
> tell the user that the
> password was incorrect, rather just display a note
> telling them that the
> username or password was incorrect.  This way a
> hacker never knows if they
> have a valid user name or not.  It may not matter,
> but that is what I was
> taught.  hope that helps.
> 
> Dave
> 
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: Monday, March 18, 2002 15:17
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: two questions help is
> needed
> 
> 
> thanx David
> but I tried <> as well
> but not got my desired result
> any other idea?????????
> take care
> nusrat
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/


Message #10 by nusrat sarwar <nusratsarwar@y...> on Wed, 20 Mar 2002 10:21:20 -0800 (PST)
Hi Tom
I tried the qoutes but it didnt help a bit
yes I have to try slash
how could  it be?
I am still wondering how an easy thing becomes
difficult and irritating
thanx for yr time and help
take care
regards
nusrat


--- TomMallard <mallard@s...> wrote:
> Sounds like you have single or double quotes in the
> data values. Those need
> to be doubled or use a backslash escape.
> 
> tom mallard
> seattle
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: Wednesday, March 20, 2002 5:58 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: two questions help is
> needed
> 
> 
> Hi David
> Thanx for advise
> my clients wanted that
> but now I think I better convince them not to have
> these choices
> God bless you
> but David the first query still bothering
> I have tried both ' ' and " "
> <option value="<%=rs("id")%>"><%=rs("id")%></option>
> and
> <option value='<%=rs("id")%>'><%=rs("id")%></option>
> but list not showing /picking values from DB
> I dont know what I should do
> I am stuck
> many thanx for yr concern and time
> 
> take care
> regards
> nusrat
> 
> 
> --- "Debreceni, David"
> <Debreceni.David@h...>
> wrote:
> > Your query checks for a matching username and
> > password, so you will never
> > get the the third criterea of your if statement. 
> If
> > the password does not
> > match the username then you will get a eof.  Take
> > the "and Password..."  out
> > of the sql ans see if that works the way you want
> it
> > to.
> > Just food for thought, I was always taught to
> never
> > tell the user that the
> > password was incorrect, rather just display a note
> > telling them that the
> > username or password was incorrect.  This way a
> > hacker never knows if they
> > have a valid user name or not.  It may not matter,
> > but that is what I was
> > taught.  hope that helps.
> >
> > Dave
> >
> > -----Original Message-----
> > From: nusrat sarwar
> [mailto:nusratsarwar@y...]
> > Sent: Monday, March 18, 2002 15:17
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] RE: two questions help is
> > needed
> >
> >
> > thanx David
> > but I tried <> as well
> > but not got my desired result
> > any other idea?????????
> > take care
> > nusrat
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - live college hoops coverage
> > http://sports.yahoo.com/
> >
> >
> >
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #11 by nusrat sarwar <nusratsarwar@y...> on Wed, 20 Mar 2002 11:31:34 -0800 (PST)
Hi David
here it is

  <form action="orderinsert.asp" method="post"
name="frm" onsubmit="return isname()">
                      <table width="616">
                        <tr>
                          <td valign="top"
align="left" width="206"><font face="Verdana" size="3"
color="#000080"><b>Vehicle Details</b></font></td>
                          <td valign="top"
align="left" width="396"><font size="2"
face="Verdana">&nbsp;</font></td>
                        </tr>
                        <tr>
                          <td valign="top"
align="left" width="206"><font size="2"
face="Verdana">Stock Number (SN)</font></td>
                          <td valign="top"
align="left" width="396"><font size="2"
face="Verdana">
<%
strconn = "DRIVER=Microsoft Access Driver
(*.mdb);DBQ=" &
Server.MapPath("/data/carjunction.mdb") 
set conn = server.createobject("ADODB.Connection")
set rs = server.createobject("ADODB.Recordset")
conn.open strconn

rs.open "SELECT *  from cardetail ;", conn,2,2
%>
		<select size="1" name="SNRef"
onChange="MjumpM_Menu('parent',this,1)">
		<option value="none" selected>Select St.No.
	<% while Not rs.eof %>		
		<option
value="<%=rs("sno")%>"><%=rs("sno")%></option>
		</select>

     </font></td>
 <% 
rs.MoveNext
 wend

rs.close
set rs=nothing
conn.close
set conn = nothing
%>
                        </tr>

                        <tr>
                          <td valign="top"
align="left" width="206"><font size="2"
face="Verdana">Vehicle make and
                            model</font></td>
                          <td valign="top"
align="left" width="396"><font size="2"
face="Verdana">
						  
 <input maxLength="50" size="30"
name="MakeModel"></font></td>
                        </tr>
I print the value on page it is doing fine.

picking up value but not showing in listbox

please help me out 
many thanx
take care
regards
nusrat



--- "Debreceni, David" <Debreceni.David@h...>
wrote:
> 
> can you out put those values just for printing with
> out a problem?
> 
> ie response.write rs("id")
> 
> Are the values just not showing up in the select
> box?  Can you post some
> more of your code so we can see what exactly you are
> doing?  Your not
> hitting an EOF for the recordset are you?  Not
> really sure at this point.
> Thanks
> 
> Dave
> -----Original Message-----
> From: nusrat sarwar [mailto:nusratsarwar@y...]
> Sent: Wednesday, March 20, 2002 8:58 AM
> To: ASP Web HowTo
> Subject: [asp_web_howto] RE: two questions help is
> needed
> 
> 
> Hi David
> Thanx for advise 
> my clients wanted that 
> but now I think I better convince them not to have
> these choices
> God bless you
> but David the first query still bothering
> I have tried both ' ' and " "
> <option value="<%=rs("id")%>"><%=rs("id")%></option>
> and
> <option value='<%=rs("id")%>'><%=rs("id")%></option>
> but list not showing /picking values from DB
> I dont know what I should do 
> I am stuck
> many thanx for yr concern and time
> 
> take care
> regards
> nusrat
> 
> 
> --- "Debreceni, David"
> <Debreceni.David@h...>
> wrote:
> > Your query checks for a matching username and
> > password, so you will never
> > get the the third criterea of your if statement. 
> If
> > the password does not
> > match the username then you will get a eof.  Take
> > the "and Password..."  out
> > of the sql ans see if that works the way you want
> it
> > to.  
> > Just food for thought, I was always taught to
> never
> > tell the user that the
> > password was incorrect, rather just display a note
> > telling them that the
> > username or password was incorrect.  This way a
> > hacker never knows if they
> > have a valid user name or not.  It may not matter,
> > but that is what I was
> > taught.  hope that helps.
> > 
> > Dave
> > 
> > -----Original Message-----
> > From: nusrat sarwar
> [mailto:nusratsarwar@y...]
> > Sent: Monday, March 18, 2002 15:17
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] RE: two questions help is
> > needed
> > 
> > 
> > thanx David
> > but I tried <> as well
> > but not got my desired result
> > any other idea?????????
> > take care
> > nusrat
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Sports - live college hoops coverage
> > http://sports.yahoo.com/
> > 
> > 
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #12 by "Debreceni, David" <Debreceni.David@h...> on Wed, 20 Mar 2002 15:29:09 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1D04D.E39E0DD0
Content-Type: text/plain;
	charset="iso-8859-1"

You need to take the select closing statement out of the while loop

<% while Not rs.eof %>		
		<option
value="<%=rs("sno")%>"><%=rs("sno")%></option>
		</select>

     </font></td>
 <% 
rs.MoveNext
 wend

SHould be 
<% while Not rs.eof %>		
		<option
value="<%=rs("sno")%>"><%=rs("sno")%></option>
		

     </font></td>
 <% 
rs.MoveNext
 wend
%>
</select>


hope that helps

Dave

Message #13 by "Debreceni, David" <Debreceni.David@h...> on Wed, 20 Mar 2002 15:31:15 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1D04E.2EA02C00
Content-Type: text/plain;
	charset="iso-8859-1"


make certain you take </font></td> out of the loop as well.

Dave

Message #14 by nusrat sarwar <nusratsarwar@y...> on Thu, 21 Mar 2002 00:29:02 -0800 (PST)
Hi Dave
hope u r well and fine
thanx
I'll try it and will let you know
many thanx for yr time
take care
regards
nusrat

--- "Debreceni, David" <Debreceni.David@h...>
wrote:
> You need to take the select closing statement out of
> the while loop
> 
> <% while Not rs.eof %>		
> 		<option
> value="<%=rs("sno")%>"><%=rs("sno")%></option>
> 		</select>
> 
>      </font></td>
>  <% 
> rs.MoveNext
>  wend
> 
> SHould be 
> <% while Not rs.eof %>		
> 		<option
> value="<%=rs("sno")%>"><%=rs("sno")%></option>
> 		
> 
>      </font></td>
>  <% 
> rs.MoveNext
>  wend
> %>
> </select>
> 
> 
> hope that helps
> 
> Dave
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

  Return to Index