Solved

Problem Getting Value of Recordsets to Show Up in Case Select

Posted on 2009-05-03
6
332 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Did we resolve your original question?
0
 

Author Comment

by:GMMC_man
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

743 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

15 Experts available now in Live!

Get 1:1 Help Now