Problem Getting Value of Recordsets to Show Up in Case Select

Posted on 2009-05-03
Last Modified: 2012-05-06
Hi Experts,

Got a perplexing problem with my case select statement. Apparently I'm doing something wrong because after trying several different approaches my switch is not working. The code is below. At this point I'm getting the error
Microsoft VBScript compilation  error '800a03f6'

Expected 'End'

/gmmcPub/CheckExisting.asp, line 303

Dim rsDreams__MMColParam
rsDreams__MMColParam = "1"
If (Session("MM_userID") <> "") Then 
  rsDreams__MMColParam = Session("MM_userID")
End If
Dim rsDreams
Dim rsDreams_cmd
Dim rsDreams_numRows
Set rsDreams_cmd = Server.CreateObject ("ADODB.Command")
rsDreams_cmd.ActiveConnection = MM_connGMMCdata_STRING
rsDreams_cmd.CommandText = "SELECT dreamID, memberID, dreamDate FROM dbo.dreams WHERE memberID = ?" 
rsDreams_cmd.Prepared = true
rsDreams_cmd.Parameters.Append rsDreams_cmd.CreateParameter("param1", 5, 1, -1, rsDreams__MMColParam) ' adDouble
Set rsDreams = rsDreams_cmd.Execute
rsDreams_numRows = 0
Dim rsReality__MMColParam
rsReality__MMColParam = "1"
If (Session("MM_userID") <> "") Then 
  rsReality__MMColParam = Session("MM_userID")
End If
Dim rsReality
Dim rsReality_cmd
Dim rsReality_numRows
Set rsReality_cmd = Server.CreateObject ("ADODB.Command")
rsReality_cmd.ActiveConnection = MM_connGMMCdata_STRING
rsReality_cmd.CommandText = "SELECT transID, userID, transDate FROM dbo.finAnalysisNetWorth WHERE userID = ?" 
rsReality_cmd.Prepared = true
rsReality_cmd.Parameters.Append rsReality_cmd.CreateParameter("param1", 5, 1, -1, rsReality__MMColParam) ' adDouble
Set rsReality = rsReality_cmd.Execute
rsReality_numRows = 0
Dim rsBudget__MMColParam
rsBudget__MMColParam = "1"
If (Session("MM_userID") <> "") Then 
  rsBudget__MMColParam = Session("MM_userID")
End If
Dim rsBudget
Dim rsBudget_cmd
Dim rsBudget_numRows
Set rsBudget_cmd = Server.CreateObject ("ADODB.Command")
rsBudget_cmd.ActiveConnection = MM_connGMMCdata_STRING
rsBudget_cmd.CommandText = "SELECT transID, userID, transDate FROM dbo.finAnalysisFixedExpenses WHERE userID = ?" 
rsBudget_cmd.Prepared = true
rsBudget_cmd.Parameters.Append rsBudget_cmd.CreateParameter("param1", 5, 1, -1, rsBudget__MMColParam) ' adDouble
Set rsBudget = rsBudget_cmd.Execute
rsBudget_numRows = 0
Dim rsFlexible__MMColParam
rsFlexible__MMColParam = "1"
If (Session("MM_userID") <> "") Then 
  rsFlexible__MMColParam = Session("MM_userID")
End If
Dim rsFlexible
Dim rsFlexible_cmd
Dim rsFlexible_numRows
Set rsFlexible_cmd = Server.CreateObject ("ADODB.Command")
rsFlexible_cmd.ActiveConnection = MM_connGMMCdata_STRING
rsFlexible_cmd.CommandText = "SELECT transID, userID, transDate FROM dbo.finAnalysisFlexibleExpenses WHERE userID = ?" 
rsFlexible_cmd.Prepared = true
rsFlexible_cmd.Parameters.Append rsFlexible_cmd.CreateParameter("param1", 5, 1, -1, rsFlexible__MMColParam) ' adDouble
Set rsFlexible = rsFlexible_cmd.Execute
rsFlexible_numRows = 0
Dim rsIncome__MMColParam
rsIncome__MMColParam = "1"
If (Session("userID") <> "") Then 
  rsIncome__MMColParam = Session("userID")
End If
Dim rsIncome
Dim rsIncome_cmd
Dim rsIncome_numRows
Set rsIncome_cmd = Server.CreateObject ("ADODB.Command")
rsIncome_cmd.ActiveConnection = MM_connGMMCdata_STRING
rsIncome_cmd.CommandText = "SELECT transID, userID, transDate, YourTakeHomePay, SpouseTakeHomePay, Allowances, ChildSupport, SocialSecurity, PublicAssistance, Pension, Other1, Other2, ParentTransID, totalIncome FROM dbo.finAnalysisIncome WHERE userID = ?" 
rsIncome_cmd.Prepared = true
rsIncome_cmd.Parameters.Append rsIncome_cmd.CreateParameter("param1", 5, 1, -1, rsIncome__MMColParam) ' adDouble
Set rsIncome = rsIncome_cmd.Execute
rsIncome_numRows = 0
Dim MM_query
Dim MM_reviewLink
Dim MM_linkID
Dim MM_reportLink
Dim MM_linkDate
Dim page
page = request.querystring("page")
	CASE "dreams"
		If rsDreams.RecordCount > 1 then
			MM_query = rsDreams("memberID")
			MM_reviewLink = "dreamsReview.asp"
			MM_linkID = rsDreams("dreamID")
			MM_reportLink = "empowerment.asp"
			MM_linkDate = rsDreams("dreamDate")
			If rsDreams.RecordCount = 1 then
				Response.redirect("dreamsReview.asp?memberID=" & Session("userID"))
				If rsDreams.EOF then
					response.write("rsDreams empty")
				end if
		    End If 
		End If   
		CASE "reality"
		If rsReality.RecordCount > 1 then		
			MM_query = rsReality("userID")
			MM_pagelink = "realityReview.asp"
			MM_linkID = rsReality("transID")
			MM_reportLink = "empowerment.asp"
			MM_linkDate = rsReality("transDate")
			If rsReality.RecordCount = 1 then
				Response.redirect("realityReview.asp?userID=" & Session("userID"))
				If rsReality.EOF then
					response.write("rsReality empty")
				end if
		    End If 
		End If   
		CASE "budget"
			If rsBudget.RecordCount > 1 then		
			MM_query = rsBudget("userID")
			MM_pagelink = "budgetReview.asp"
			MM_linkID = rsBudget("transID")
			MM_reportLink = "empowerment.asp"
			MM_linkDate = rsBudget("transDate")
	If rsBudget.RecordCount = 1 then
				Response.redirect("budgetReview.asp?userID=" & Session("userID"))
				If rsBudget.EOF then
					response.write("rsBudget empty")
				end if
		    End If 
		End If   	
		CASE "flexible"
		If rsFlexible.RecordCount > 1 then
			MM_query = rsFlexible("userID")
			MM_pagelink = "flexibleReview.asp"
			MM_linkID = rsFlexible("transID")
			MM_reportLink = "empowerment.asp"
            MM_linkDate = rsFlexible("transDate")
	If rsFlexible.RecordCount = 1 then
				Response.redirect("flexibleReview.asp?userID=" & Session("userID"))
				If rsFlexible.EOF then
					response.write("rsFlexible empty")
				end if
		    End If 
		End If   
		CASE "income"
		If rsIncome.RecordCount > 1 then
			MM_query = rsIncome("userID")
			MM_pagelink = "incomeReview.asp"
			MM_linkID = rsIncome("transID")
			MM_reportLink = "empowerment.asp"
			MM_linkDate = rsIncome("transDate")
	If rsIncome.RecordCount = 1 then
				Response.redirect("incomeReview.asp?userID=" & Session("userID"))
				If rsIncome.EOF then
					response.write("rsIncome empty")
				end if
		    End If 
		End If   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Financial Analysis - What Are Your Fixed Expenses?</title>
<div id="Article">
      <table width="75%" border="0" cellspacing="0" cellpadding="3">
          <td><h3>Existing transactions for <%=Session("MM_firstName") & " " & Session("MM_lastName")%></h3>
            <table width="282" border="1" cellpadding="3" cellspacing="0">
                <td width="23">ID</td>
                  <td width="120">Transaction ID<br /> 
                  (Select to modify)</td>
                  <td width="113"> Date <br />
                  (Select to see report)</td>
                <td><a href="<%=MM_reviewLink%>"><%=MM_linkID %></td>
                <td><a href="<%=MM_reportLink%>"><%=MM_linkDate %></td>
      <!-- end #mainContent -->
  <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
Set rsDreams = Nothing
Set rsReality = Nothing
Set rsBudget = Nothing
Set rsFlexible = Nothing
Set rsIncome = Nothing

Open in new window

Question by:GMMC_man
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
  • 3
  • 2
LVL 75

Accepted Solution

Anthony Perkins earned 500 total points
ID: 24290089
I am not sure what this has to do with MS SQL Server, but your problem is that you have an extra:
      SELECT CASE page
at line 139.

Just delete it or comment it out.
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 24290856
acperkins is correct. remove or comment  'SELECT CASE page
before this statement and check

CASE "reality"
            If rsReality.RecordCount > 1 then

Author Comment

ID: 24303238
I've removed the extra Select Case line. I'm passing url parameter ?page=dreams to this page. It takes me right to dream.asp as a new user even though Session("MM_userID") is set and an existing matching record exists. When testing the recordset it shows the record so my sql is fine. For some reason my switch is not working. Please check my case statement and if statements to see if there is a better way to do this or whether my syntax is off.


Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 75

Expert Comment

by:Anthony Perkins
ID: 24306858
Did we resolve your original question?

Author Comment

ID: 24316235
Partially. After removing the extra Select Case line  I no longer getting a compilation error, however I'm still getting an error getting values of recordsets to show up.
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24317643
Since this is a new problem that was not in your original question, you may have more success if you post a new question, with a link back to this question for further information.

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

717 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