Solved

Problem Getting Value of Recordsets to Show Up in Case Select

Posted on 2009-05-03
6
335 Views
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")
 
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
Comment
Question by:GMMC_man
  • 3
  • 2
6 Comments
 
LVL 75

Accepted Solution

by:
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.
0
 
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
0
 

Author Comment

by:GMMC_man
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.

Thanks.

0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 75

Expert Comment

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

Author Comment

by:GMMC_man
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.
0
 
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.
0

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

830 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