Solved

asp syntax (Classic ASP VB Script page)

Posted on 2014-07-24
11
369 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
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.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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).

911 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

19 Experts available now in Live!

Get 1:1 Help Now