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
Solved

asp syntax (Classic ASP VB Script page)

Posted on 2014-07-24
11
376 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

837 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