Solved

asp syntax (Classic ASP VB Script page)

Posted on 2014-07-24
11
372 Views
Last Modified: 2014-07-24
I am redirecting if a recordset is empty using:

<%
If rsCaseEB5.EOF And rsCaseEB5.BOF Then
Response.Redirect("UpdatecasedetailsEB5.asp?caseid=<%=(Casesjoin.Fields.Item("Id").Value)%>")
End If
%>

I get this syntax error:

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/bluedot/Intranet/Cases/GeneralInfo/Updatecasedetails.asp, line 112

Response.Redirect("UpdatecasedetailsEB5.asp?caseid=<%=(Casesjoin.Fields.Item("Id").Value)
------------------------------------------------------------------------------^


What would the correct syntax be ?
0
Comment
Question by:amucinobluedot
  • 4
  • 3
  • 3
11 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 286 total points
ID: 40216975
no need for the extra <% %> tags, change to:

<%
If rsCaseEB5.EOF And rsCaseEB5.BOF Then
Response.Redirect("UpdatecasedetailsEB5.asp?caseid=" & Casesjoin.Fields.Item("Id").Value )
End If
%>
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 214 total points
ID: 40216982
<%
If rsCaseEB5.EOF OR rsCaseEB5.BOF Then
Response.Redirect("UpdatecasedetailsEB5.asp?caseid="&Casesjoin.Fields.Item("Id").Value)
End If
%>

Open in new window


EDIT, change from AND to OR
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 286 total points
ID: 40216983
since you're already in "server-side mode", you want to concatenate the string, not use separate <% %> tags
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:amucinobluedot
ID: 40217001
I am now using:

<%
If rsCaseEB5.EOF OR rsCaseEB5.BOF Then
Response.Redirect("UpdatecasedetailsEB5.asp?caseid="&Casesjoin.Fields.Item("Id").Value)
End If
%>

I get this error:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/bluedot/Intranet/Cases/GeneralInfo/UpdatecasedetailsEB5.asp, line 117

Response.Redirect("Updatecasedetails.asp?caseid=<%=(Casesjoin.Fields.Item('Id').Value)
--------------------------------------------------------------------------------------^
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 286 total points
ID: 40217017
you have an extra <%= in there, copy and paste the code EXACTLY as it is below

<%
If rsCaseEB5.EOF OR rsCaseEB5.BOF Then
Response.Redirect("UpdatecasedetailsEB5.asp?caseid=" & Casesjoin.Fields.Item("Id").Value)
End If
%>
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 214 total points
ID: 40217021
The <% tags are to start and end ASP code.  You are already in ASP so you are double dipping so to speak.  

Response.Redirect("Updatecasedetails.asp?caseid=<%=(Casesjoin.Fields.Item('Id').Value)

Should be

Response.Redirect("Updatecasedetails.asp?caseid="&Casesjoin.Fields.Item('Id').Value)
0
 

Author Comment

by:amucinobluedot
ID: 40217032
This worked
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 286 total points
ID: 40217094
the first answer that was posted worked as well, so why not at the very least a split?

the code

if rs.BOF and rs.EOF will return TRUE if there are no records returned,

Please click request Attention to have the question re-opened so you can close it properly.
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 214 total points
ID: 40217262
Actually, it is preferred to use NOT.

I don't remember why, but there must have been a good reason along that way.   I have always used

if not rs.bof or not rs.eof then
     ' we have good data
     else
     ' no data
end if

Open in new window

0
 

Author Closing Comment

by:amucinobluedot
ID: 40217288
There
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question