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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question (Absolute beginner)

Status
Not open for further replies.

dbrooks74

Programmer
Nov 13, 2001
105
US
I'm trying to figure out how to write ASP code. I know I should enclose everything in the <% %> symbols but what about head tags? I have the following code, can someone tell me what should be in the <% and what shouldn't.


<HEAD>
<TITLE>To Do Listing</TITLE>
</HEAD>
<BODY>
<%
Option Explicit

Response.Expires = 0

Dim con, objRS, strconnect

Set con = Server.CreateObject (&quot;ADODB.Connection&quot;)
con.Open &quot;DSN=ToDoList;UID=;PWD=;&quot;
strconnect = &quot;Select * From TASK&quot;
Set objRS = con.Execute(strconnect)

Response.Write (&quot;<b>List of people stored in the Personnel table are listed below:</b>&quot;)
Response.Write (&quot;<p>&quot;)

Response.Write &quot;<TABLE>&quot;

While Not objRS.EOF
Response.Write &quot;<TR>&quot;
Response.Write &quot;<b>&quot; & &quot;<TD>&quot; & objRS(&quot;TASK_USER&quot;) & _
&quot; &quot; & &quot;</TD>&quot; & &quot;<TD>&quot; & objRS(&quot;TASK_NAME&quot;) & &quot;</TD>&quot; & &quot;</b>&quot;
Response.Write (&quot;<BR>&quot;)
objRS.MoveNext
Response.Write &quot;</TR>&quot;
Wend

Response.Write &quot;</TABLE>&quot;

objRS.close
con.Close
Set objRS = Nothing
Set con = Nothing
%>
</BODY>
 
I continue to get this error message. -db


Microsoft VBScript compilation error '800a0400'

Expected statement

/test.asp, line 6

Option Explicit


If I take out everything above the <% symbol it works fine. -db

 
the Option Explicit will typically go above any html in the page.
<%
Option Explicit
Response.Expires = 0
Dim con, objRS, strconnect
Set con = Server.CreateObject (&quot;ADODB.Connection&quot;)
con.Open &quot;DSN=ToDoList;UID=;PWD=;&quot;
strconnect = &quot;Select * From TASK&quot;
Set objRS = con.Execute(strconnect)
%>
<HTML>
<HEAD>
<TITLE>To Do Listing</TITLE>
</HEAD>
<BODY>
<%
Response.Write (&quot;<b>List of people stored in the Personnel table are listed below:</b>&quot;)
Response.Write (&quot;<p>&quot;)
Response.Write &quot;<TABLE>&quot;
While Not objRS.EOF
Response.Write &quot;<TR>&quot;
Response.Write &quot;<b>&quot; & &quot;<TD>&quot; & objRS(&quot;TASK_USER&quot;) & _
&quot; &quot; & &quot;</TD>&quot; & &quot;<TD>&quot; & objRS(&quot;TASK_NAME&quot;) & &quot;</TD>&quot; & &quot;</b>&quot;
Response.Write (&quot;<BR>&quot;)
objRS.MoveNext
Response.Write &quot;</TR>&quot;
Wend
Response.Write &quot;</TABLE>&quot;
objRS.close
con.Close
Set objRS = Nothing
Set con = Nothing
%>
</BODY>
</HTML>

Was it something I said?
admin@onpntwebdesigns.com
 
Option explicit must be the first statement on your page execpt for your language specification.

Place this at the top of your code instead of after the HTML:
<%@ Language=VBScript %>
<% option explicit %>

Thanks,

Gabe
 
Dim con, objRS, strconnect
Set con = Server.CreateObject (&quot;ADODB.Connection&quot;)


Do you need to Dim 'con'? www.vzio.com
ASP WEB DEVELOPMENT



 
yes
-tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top