Click to See Complete Forum and Search --> : Simple ASP Code Question


Delphi00
01-31-2004, 10:00 AM
Why doesn't the following page display on Brinkster (or any other host which support ASP)?


<%
Option Explicit
Response.Expires = -1000

Response.Write("<head><title>Classified: For Sale</title></head>")
Response.Write("<STYLE TYPE='TEXT/CSS'>")
Response.Write("<!--")
Response.Write("A { color:black ; text-decoration: none;}")
Response.Write(".content { color:black ; font-size:12; font-family:arial;}")
Response.Write(".content2 { color:black ; font-size:12; font-weight: bold; font-family:arial;}")
Response.Write(".form1 { background-color: white;border:1px #000000 solid; color:#000000 ; font-size:10; font-family:arial;}")
Response.Write("-->")
Response.Write("</STYLE>")
Response.Write("<body bgcolor=#33669A>")
Response.Write("<table align=center width=800 border="0" cellspacing="1" cellpadding="1">")
Response.Write("<tr bgcolor=#EEEEEE>")
Response.Write("<td bgcolor=#FFC800 align=center><font style='color:#000000 ; font-size:9; font-family:arial; font-weight:bold;'>Classified: For Sale</font></td>")
Response.Write("</tr>")
Response.Write("<tr bgcolor=#EEEEEE>")
Response.Write("<td valign=top>")
Response.Write("<table width="800" border="0" width="582" cellspacing="0" cellpadding="0">")
Response.Write("<tr>")
Response.Write("<td width="62"><font class=content2>Browse:</font></td>")
Response.Write("<td width="208"><font class=content2><a href="bookssale.htm">¹&nbsp;Books</font></td>")
Response.Write("<td width="416" align="right"><font class=content2><a href="register.htm">¹&nbsp;Register</a></font></td>")
Response.Write("<td align="right"><font class=content2>Search:</font></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<form name=searchform action=search.asp METHOD=POST>")
Response.Write("<td width="62">&nbsp;</td>")
Response.Write("<td width="208"><a href="computerpartssale.htm"><font class=content2>²&nbsp;Computer Parts</font></td>")
Response.Write("<td width="416" align="right"><font class=content2><a href="login.htm">²&nbsp;LOGIN</a></font></td>")
Response.Write("<td align="right">&nbsp;<INPUT TYPE=TEXT NAME=SearchField SIZE=20 CLASS=form1></td>")
Response.Write("</form>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td width="62">&nbsp;</td>")
Response.Write("<td width="208"><font class=content2><a href="miscellaneoussale.htm">³&nbsp;Miscellaneous</td>")
Response.Write("<td valign=top width="416" align="right"><font class="content2"><a href="help.htm">³&nbsp;Help</a></font></td>")
Response.Write("<td align="right">&nbsp;</td>")
Response.Write("</tr>")
Response.Write("</table>")
Response.Write("</td>")
Response.Write("</tr>")
Response.Write("</table>")
Response.Write("<table align=center width=804 border="0" cellspacing="1" cellpadding="1">")
Response.Write("<tr align=center bgcolor=#FFC800 style='color:black; font-weight: bold'>")
Response.Write("<td>font class=content2>Course No.</font></td>")
Response.Write("<td><font class=content2>Title</font></td>")
Response.Write("<td><font class=content2>Description</font></td>")
Response.Write("<td><font class=content2>Price</font></td>")
Response.Write("<td><font class=content2>Contact</font></a></td>")
Response.Write("</tr>")
Response.Write("<tr>")
Response.Write("<td bgcolor=#FFC800 colspan=100 align=right><font style='color:#000000 ; font-size:11; font-family:arial; font-weight: bold;'>Count: " & counter & "/ALL</font></td>")
Response.Write("</tr>")
Response.Write("</table>")
Response.Write("</body>")
%>


It's REALLY simple html typed out useing Response.Write! This is really frustrating, can anyone PLEASE help me out?

Strogian
01-31-2004, 10:16 AM
Response.Write("<table align=center width=800 border="0" cellspacing="1" cellpadding="1">")

^^ That's no good.

ksuohio
01-31-2004, 11:15 AM
I'm not seeing a beginning and ending html tag. Also, why did you the Resonse.write method? You could have just typed the html code since it doesn't appear that you are using any additional scripting.

Delphi00
01-31-2004, 11:29 AM
Thanks for the reply guys

Originally posted by ksuohio
I'm not seeing a beginning and ending html tag. Also, why did you the Resonse.write method? You could have just typed the html code since it doesn't appear that you are using any additional scripting.

It doesn't need an HTML tag and i stripped off my asp code becasue they were not relevant to the problem...

Thank Strogian, I think that's where my prob is, thanks!

EDIT:
Do you guys know any betetr way other than having to type out response.write for everyline of html code? thanks...:)

EDIT2:
Why doesn't this work?
sSQL = "SELECT Course, Title, Description, Price, Contact FROM Sale ORDER BY Course Where Type='Book'"
The WHERE part gives an error...:(

Gary K
01-31-2004, 03:54 PM
You need to place your where statement ahead of your order by statement.

Order by sorts the output of your query, and you can't sort the order before you have defined the focus of your query.

Delphi00
01-31-2004, 05:19 PM
Originally posted by Gary K
You need to place your where statement ahead of your order by statement.

Order by sorts the output of your query, and you can't sort the order before you have defined the focus of your query.

THANK YOU!!!!!!!! :D :D :D

BTW: Do you know a more efficient way to deal with the HTML i'm using instead of using response.write every time?

Strogian
01-31-2004, 06:55 PM
Is there a reason you can't just do something like this:

<%
option explicit
response.expires = -1000
%>

<head>
<title>blah</title>
</head>

...

Delphi00
01-31-2004, 08:05 PM
Originally posted by Strogian
Is there a reason you can't just do something like this:

<%
option explicit
response.expires = -1000
%>

<head>
<title>blah</title>
</head>

...

can i do this?

<%
option explicit
response.expires = -1000
%>

<head>
<title>blah</title>
</head>

<%
(some ASP code)
%>

ksuohio
01-31-2004, 10:30 PM
Originally posted by Delphi00
can i do this?

<%
option explicit
response.expires = -1000
%>

<head>
<title>blah</title>
</head>

<%
(some ASP code)
%>

Yes, basically, any place that you want to script just enclose it in <% %> and you should be set. That's why I was questioning using the response.write method when the page was mostly html. Response.write is most useful when the text is dynamic.

Strogian
01-31-2004, 11:16 PM
you can even do this:

<%
IF something THEN
%>
html text
<%
ELSE
%>
other html text
<%
END IF
%>

Delphi00
02-01-2004, 12:52 AM
wow i didn't know that...thanks ppl! :D