Solved

asp syntax (Classic ASP VB Script page)

Posted on 2014-07-24
11
365 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 32

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 32

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
 

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 32

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 32

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now