Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbie : I want to keep showing username & password as an option

0 views
Skip to first unread message

techy techno

unread,
Jan 13, 2004, 4:10:59 AM1/13/04
to

I have 3 fields in my Access DB called URL, Username & password.

I am displaying all the 3 fields on the ASP Page.
What I want is :

I want to show all the fields obvious

BUT

If a particular URL doesn't have a userName and Password then I just
want to
see the URL and the username and password for that URL should not be
diplayed.

thanks


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Ray at <%=sLocation%>

unread,
Jan 13, 2004, 8:40:53 AM1/13/04
to
What code are you using to do this? It seems that if you're pulling the
three values from a database, and the two columns are empty, nothing would
be displayed then just as you'd like. Or, do you mean specifically no
username AND no password? If so, something like:

<%
sUsername = rs.fields.item("theUsername").Value
sPassword = rs.fields.item("thePassword").Value
sURL = rs.Fields.Item("URL").Value

If sUsername & sPassword <> "" Then
Response.Write "Your username is " & sUsername & "<br>"
Response.Write "Your password is " & sPassword & "<br>"
End If

Response.Write "The URL is " & sURL
%>

Ray at work

"techy techno" <anwar_...@hotmail.com> wrote in message
news:OMowpUb2...@tk2msftngp13.phx.gbl...

techy techno

unread,
Jan 14, 2004, 12:59:33 AM1/14/04
to

i have a table where I am showing URL, Username, PAss

URL : something
USername : something
password : something

now the thing is that if username and password is empty


it wiil show like this


URL : something
Username :
password :

See I know it will not show the username and pass but the it will show
the HTML text
so what I did is I made 2 HTML table namely : for eg.

TABLE_show = shows all the 3 fields

url_table = only shows the URL


TABLE_show shows all the 3 fields url, Username and password

url_table shows only the URL


now what I need is if username and password exists I want asp code to
show me TABLE_Show

and if the username and pasword doesn't exist I want the asp code to
show me the URL_TABLE


what I wrote is this :


sUsername = rs.fields.item("theUsername").Value
sPassword = rs.fields.item("thePassword").Value
sURL = rs.Fields.Item("URL").Value

If sUserName and sPAssword <> "" THEN
<table>
<tr>
<td>
response.write "Your URL is " & sURL& "<br>"


Response.Write "Your username is " & sUsername & "<br>"

Response.Write "Your username is " & spassword & "<br>"
<td>
</tr>
</table>

<% ELSE %>

<table>
<tr>
<td>
response.write "Your URL is " & sURL& "<br>"
<td>
</tr>
</table>
<% END IF %>

Roland Hall

unread,
Jan 14, 2004, 7:17:10 PM1/14/04
to
"techy techno" wrote:

: See I know it will not show the username and pass but the it will show


: the HTML text
: so what I did is I made 2 HTML table namely : for eg.
:

: TABLE_show shows all the 3 fields url, Username and password

dim szURL, szUN, szPW ' --- url, username and password strings
dim tTop, tBot ' --- table top, table bottom
dim szTable ' --- table string

sUsername = rs.fields.item("theUsername").Value

szUN = "Your username is "


sPassword = rs.fields.item("thePassword").Value

szPW = "Your password is "


sURL = rs.Fields.Item("URL").Value

szURL = "Your URL is "
tTop = "<table><tr><td>"
tBot = "</td></tr></table>"

If sUserName and sPassword <> "" Then
szTable = tTop & szURL & sURL & "<br />" & szUN & sUsername & "<br />" &
szPW & spassword & "<br />" & tBot
else
szTable = tTop & szURL & sURL & "<br />"
end if

Response.Write(szTable)

However, this would be easier on the client-side:

<script type="text/javascript">
function untest() {
if('<%sUsername%>' == '' && '<%sPassword%>' == '') {
} else {
document.getElementById('2').style.display='block';
document.getElementById('3').style.display='block';
}
}
</script>

<body onload="untest()">

<table><tr><td>
<div id=1>Your URL is <%=sURL%></div>
<div id=2 style="display: none">Your username is <%=sUsername%></div>
<div id=3 style="display: none">Your password is <%=sPassword%></div>
</td></tr></table>

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp


0 new messages