Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

asp syntax (Classic ASP VB Script page)

Posted on 2014-07-24
11
Medium Priority
?
395 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
11 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 1144 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 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 856 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 1144 total points
ID: 40216983
since you're already in "server-side mode", you want to concatenate the string, not use separate <% %> tags
0
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 

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 1144 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 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 856 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 1144 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 53

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 856 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

705 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