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

asp problems

Status
Not open for further replies.

deecee

Technical User
Joined
Aug 25, 2001
Messages
1,678
Location
US

ok im going through teh tutorial for asp and when i click off the search page i get this error

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/MyTutorialSite/Results.asp, line 259, column 29
var Results__MMColParam = "1";
----------------------------^


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)

Page:
GET /MyTutorialSite/Results.asp

Time:
Saturday, March 23, 2002, 4:35:48 PM


More information:
Microsoft Support

i cant figure out where im going wrong

ive tried everything...well not everything cuz if i did i wouldnt be asking here X-)

Thnx

DEEEEEECEEEEE
 
Hi

It sounds like you have added an extra line of code to the end of the ubiquitous "Macromedia setup of variable" for a recordset.

Post the code up to about line 30 for us to see, but I think you'll find that the line which looks something like this:


Code:
<%
Dim rsFacDetail__MMColParam
rsFacDetail__MMColParam = &quot;1&quot;
if (Request.QueryString(&quot;ma_urn&quot;) <> &quot;&quot;) then rsFacDetail__MMColParam = Request.QueryString(&quot;ma_urn&quot;)
%>
If you notice the last line begins with &quot;if&quot; but doesn't end with an end if. If you add anything after this it can whine. Derren
[Mediocre talent - spread really thin]
 
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;Connections/connCompass.asp&quot; -->
<%
Dim Results__MMColParam
Results__MMColParam = &quot;1&quot;
if (Request.QueryString(&quot;DEPARTMENT&quot;) <> &quot;&quot;) then Results__MMColParam = Request.QueryString(&quot;DEPARTMENT&quot;)
%>
<%
set Results = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Results.ActiveConnection = MM_connCompass_STRING
Results.Source = &quot;SELECT EMPLOYEEID, FIRSTNAME, LASTNAME, DEPARTMENT, EXTENSION FROM EMPLOYEES WHERE DEPARTMENT = '&quot; + Replace(Results__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Results.CursorType = 0
Results.CursorLocation = 2
Results.LockType = 3
Results.Open()
Results_numRows = 0
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

' set the record count
Results_total = Results.RecordCount

' set the number of rows displayed on this page
If (Results_numRows < 0) Then
Results_numRows = Results_total
Elseif (Results_numRows = 0) Then
Results_numRows = 1
End If

' set the first and last displayed record
Results_first = 1
Results_last = Results_first + Results_numRows - 1

' if we have the correct record count, check the other stats
If (Results_total <> -1) Then
If (Results_first > Results_total) Then Results_first = Results_total
If (Results_last > Results_total) Then Results_last = Results_total
If (Results_numRows > Results_total) Then Results_numRows = Results_total
End If
 
Ah, forgot to read your post properly. What code is is around line 259 (I read it as line 29!) ? It isn't a repeating region by any chance is it? Derren
[Mediocre talent - spread really thin]
 
hers the code that the error points to....ive tried a lot but nothing changes

' set the strings for the move to links
If (MM_keepMove <> &quot;&quot;) Then MM_keepMove = MM_keepMove & &quot;&&quot;
urlStr = Request.ServerVariables(&quot;URL&quot;) & &quot;?&quot; & MM_keepMove & MM_moveParam & &quot;=&quot;
MM_moveFirst = urlStr & &quot;0&quot;
MM_moveLast = urlStr & &quot;-1&quot;
MM_moveNext = urlStr & Cstr(MM_offset + MM_size)
prev = MM_offset - MM_size
If (prev < 0) Then prev = 0
MM_movePrev = urlStr & Cstr(prev)
%>
<%
var Results__MMColParam = &quot;1&quot;;
if(String(Request.QueryString(&quot;mnuDept&quot;)) != &quot;undefined&quot;) {
Results__MMColParam = String(Request.QueryString(&quot;mnuDept&quot;));
}
%>
<%
var Results = Server.CreateObject(&quot;ADODB.Recordset&quot;);
Results.ActiveConnection = MM_connCompass_STRING;
Results.Source = &quot;SELECT EMPLOYEEID, FIRSTNAME, LASTNAME, DEPARTMENT, EXTENSION FROM EMPLOYEES WHERE DEPARTMENT = '&quot;+ Results__MMColParam.replace(/'/g, &quot;''&quot;) + &quot;'&quot;;
Results.CursorType = 0;
Results.CursorLocation = 2;
Results.LockType = 3;
Results.Open();
var Results_numRows = 0;
%>
<%
var Repeat1__numRows = 5;
var Repeat1__index = 0;
Results_numRows += Repeat1__numRows;
%>
 
Have you tried turning the immediate ifs into standards if elses?

eg:

If (MM_keepMove <> &quot;&quot;) Then
MM_keepMove = MM_keepMove & &quot;&&quot;
End if
Derren
[Mediocre talent - spread really thin]
 
<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include file=&quot;Connections/connCompass.asp&quot; -->

Try starting this way...

Hope it'll help ;-)
Have Fun...

Sharky99 >(::O>
 
didnt work
 
Ha! It's amazing what you can see when you look at a thread a few days later!

You are declaring the language as VBSCRIPT, but the code from

Code:
<%
var Results__MMColParam = &quot;1&quot;;
if(String(Request.QueryString(&quot;mnuDept&quot;)) != &quot;undefined&quot;) { 
  Results__MMColParam = String(Request.QueryString(&quot;mnuDept&quot;));
}
%>

is using javascript (ish)??! This is putting in lots of line-end semi colons and invalid vbscript syntax. Change the code to:

Code:
<%
Dim Results__MMColParam = &quot;1&quot;;
if Request.QueryString(&quot;mnuDept&quot;) <> &quot;undefined&quot;) then Results__MMColParam = Request.QueryString(&quot;mnuDept&quot;)
%>
<%
set Results = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Results.ActiveConnection = MM_connCompass_STRING
Results.Source = &quot;SELECT EMPLOYEEID, FIRSTNAME, LASTNAME, DEPARTMENT, EXTENSION FROM EMPLOYEES WHERE DEPARTMENT = '&quot;+ Results__MMColParam.replace(/'/g, &quot;''&quot;) + &quot;'&quot;
Results.CursorType = 0
Results.CursorLocation = 2
Results.LockType = 3
Results.Open()
var Results_numRows = 0
%>
<%
dim Repeat1__numRows = 5
dim Repeat1__index = 0
Results_numRows = Repeat1__numRows + 1
%>

Note that all the &quot;var&quot;s become &quot;dim&quot; s, the semi colons have gone and the syntax of the tests is slightly different - this now matches the first part of the code which is vbscript. Derren
[Mediocre talent - spread really thin]
 
Thanks Derren, i wasn't sure about the VAR

When i saw it, i thought it was something i haven't seen yet in VbS but you came back with this.

I feel better now, i'm not that stupid after all... LOL
Have Fun...

Sharky99 >(::O>
 
It came to me in a flash of inspiration after a wave of desparation! It's funny how you can look at something and your brain automatically assumes that certain bits are right! Derren
[Mediocre talent - spread really thin]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top