Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

Problem Getting Value of Recordsets to Show Up in Case Select

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")
 
SELECT CASE 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 
				Else
			response.redirect("dream.asp")
		End If   
		
	SELECT CASE page
		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 
				Else
			response.redirect("reality.asp")
		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 
				Else
			response.redirect("budget.asp")
		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 
				Else
			response.redirect("flexible.asp")
		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 
				Else
			response.redirect("income.asp")
		End If   
					
		CASE ELSE
			response.redirect("error_page.asp")
			
	END SELECT
%>	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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">
        <tr>
          <td><h3>Existing transactions for <%=Session("MM_firstName") & " " & Session("MM_lastName")%></h3>
            <table width="282" border="1" cellpadding="3" cellspacing="0">
              <tr>
                <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>
              </tr>
              <tr>
                <td><%=MM_query%></td>
                <td><a href="<%=MM_reviewLink%>"><%=MM_linkID %></td>
                <td><a href="<%=MM_reportLink%>"><%=MM_linkDate %></td>
            
              </tr>
</table></td>
        </tr>
        <tr>
          <td>&nbsp;
              <p>&nbsp;</p></td>
        </tr>
      </table>
<p>&nbsp;</p>
      <!-- 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" />
 
</body>
</html>
<%
rsDreams.Close()
Set rsDreams = Nothing
%>
<%
rsReality.Close()
Set rsReality = Nothing
%>
<%
rsBudget.Close()
Set rsBudget = Nothing
%>
<%
rsFlexible.Close()
Set rsFlexible = Nothing
%>
<%
rsIncome.Close()
Set rsIncome = Nothing
%>

Open in new window

0
GMMC_man
Asked:
GMMC_man
  • 3
  • 2
1 Solution
 
Anthony PerkinsCommented:
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.
0
 
Shanmuga SundaramDirector of Software EngineeringCommented:
acperkins is correct. remove or comment  'SELECT CASE page
            
before this statement and check

CASE "reality"
            If rsReality.RecordCount > 1 then
0
 
GMMC_manAuthor Commented:
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.

Thanks.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Anthony PerkinsCommented:
Did we resolve your original question?
0
 
GMMC_manAuthor Commented:
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.
0
 
Anthony PerkinsCommented:
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.
0

Featured Post

Technology Partners: 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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now