Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to add another variable to an asp application

New Here ,
May 10, 2006 May 10, 2006
Hi, I'm using asp in a dreamweaver dynamic application to try to build a page that displays filtered data for a particular year and month.

I currently have the application filtering by the year field, and I would like to add the month as a filter as well to make the data more specific.

Page 1 has a form with two drop down menus, the first selects the year, the second, the month.

Here is the code for the form, as well as the asp for the output page.

Any help is greatly appreciated!

TOPICS
Server side applications
458
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 10, 2006 May 10, 2006
In the recordset dialogue box click on the advanced tab and you will able to
enter a second parameter in which to search on

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"hutch1980" <webforumsuser@macromedia.com> wrote in message
news:e3tqmo$2ee$1@forums.macromedia.com...
> Hi, I'm using asp in a dreamweaver dynamic application to try to build a
> page
> that displays filtered data for a particular year and month.
>
> I currently have the application filtering by the year field, and I would
> like
> to add the month as a filter as well to make the data more specific.
>
> Page 1 has a form with two drop down menus, the first selects the year,
> the
> second, the month.
>
> Here is the code for the form, as well as the asp for the output page.
>
> Any help is greatly appreciated!
>
>
>
> form:
>
>
> <form action="catch_results_tbl.asp" target="_blank" method="post"
> name="frmYear" id="frmYear">
> <table width="50%" border="0" cellspacing="0" cellpadding="5">
> <tr>
> <td>Year</td>
> <td> <select name="fldYear" id="fldYear">
> <option value="2006" selected="selected">2006</option>
> <option value="2005">2005</option>
> <option value="2004">2004</option>
> <option value="2003">2003</option>
> <option value="2002">2002</option>
> <option value="2001">2001</option>
> <option value="2000">2000</option>
> <option value="1999">1999</option>
> <option value="1998">1998</option>
> </select></td>
> </tr>
> <tr>
> <td>Month</td>
> <td> <select name="fldMonth" id="fldMonth">
> <option value="January"
> selected="selected">January</option>
> <option value="February">February</option>
> <option value="March">March</option>
> <option value="April">April</option>
> <option value="May">May</option>
> <option value="June">June</option>
> <option value="July">July</option>
> <option value="August">August</option>
> <option value="September">September</option>
> <option value="October">October</option>
> <option value="November">November</option>
> <option value="December">December</option>
> </select></td>
> </tr>
>
> <tr>
> <td> </td>
> <td> <input type="submit" name="Submit" value="Next" />
> </td>
> </tr>
> </table>
> </form>
>
>
> Output ASP:
>
> <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
> <!--#include file="../Connections/connection.asp" -->
> <%
> Dim rsResults__MMColParam
> rsResults__MMColParam = "1"
> If (Request.Form("fldYear") <> "") Then
> rsResults__MMColParam = Request.Form("fldYear")
> End If
> %>
> <%
> Dim rsResults
> Dim rsResults_numRows
>
> Set rsResults = Server.CreateObject("ADODB.Recordset")
> rsResults.ActiveConnection = MM_connection_STRING
> rsResults.Source = "SELECT * FROM tblDaily WHERE fldYear = " +
> Replace(rsResults__MMColParam, "'", "''") + " ORDER BY fldDay ASC"
> rsResults.CursorType = 0
> rsResults.CursorLocation = 2
> rsResults.LockType = 1
> rsResults.Open()
>
> rsResults_numRows = 0
> %>
> <%
> Dim Repeat1__numRows
> Dim Repeat1__index
>
> Repeat1__numRows = -1
> Repeat1__index = 0
> rsResults_numRows = rsResults_numRows + Repeat1__numRows
> %>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 10, 2006 May 10, 2006
Thanks Paul.

I've added the second parameter by adding "fldMonth" (by clicking the field and select in the database items box below). This gives me the following SQL Statement (in the advanced builder):

SELECT *
FROM tblDaily
WHERE fldYear = MMColParam AND fldMonth
ORDER BY fldDay ASC

Do I now need to add any values into the variables torequest the fldMonth from the form?

Thanks again Paul.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 10, 2006 May 10, 2006
Yes, you need to define what the variable is

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"hutch1980" <webforumsuser@macromedia.com> wrote in message
news:e3u4vr$ds7$1@forums.macromedia.com...
> Thanks Paul.
>
> I've added the second parameter by adding "fldMonth" (by clicking the
> field
> and select in the database items box below). This gives me the following
> SQL
> Statement (in the advanced builder):
>
> SELECT *
> FROM tblDaily
> WHERE fldYear = MMColParam AND fldMonth
> ORDER BY fldDay ASC
>
> Do I now need to add any values into the variables torequest the fldMonth
> from
> the form?
>
> Thanks again Paul.
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 15, 2006 May 15, 2006
Hi, I've updated the form to submit both month and year variables. Once submitted, the output page filters only by "fldYear". Here's the code for the form, as well as the ASP from the output page.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 15, 2006 May 15, 2006
LATEST
According to the recordset code you are not doing a test on both fields as
only one variable appears.

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"hutch1980" <webforumsuser@macromedia.com> wrote in message
news:e49opi$q3r$1@forums.macromedia.com...
> Hi, I've updated the form to submit both month and year variables. Once
> submitted, the output page filters only by "fldYear". Here's the code for
> the
> form, as well as the ASP from the output page.
>
>
>
> Form
> ----------
>
> <form action="catch_results_tbl.asp" target="_blank" method="post"
> name="frmYear" id="frmYear">
> <table width="50%" border="0" cellspacing="0" cellpadding="5">
> <tr>
> <td>Year</td>
> <td> <select name="fldYear" id="fldYear">
> <option value="2006" selected="selected">2006</option>
> <option value="2005">2005</option>
> <option value="2004">2004</option>
> <option value="2003">2003</option>
> <option value="2002">2002</option>
> <option value="2001">2001</option>
> <option value="2000">2000</option>
> <option value="1999">1999</option>
> <option value="1998">1998</option>
> </select></td>
> </tr>
> <tr>
> <td>Month</td>
> <td> <select name="fldMonth" id="fldMonth">
> <option value="January"
> selected="selected">January</option>
> <option value="February">February</option>
> <option value="March">March</option>
> <option value="April">April</option>
> <option value="May">May</option>
> <option value="June">June</option>
> <option value="July">July</option>
> <option value="August">August</option>
> <option value="September">September</option>
> <option value="October">October</option>
> <option value="November">November</option>
> <option value="December">December</option>
> </select></td>
> </tr>
> <tr>
> <td> </td>
> <td> <input type="submit" name="Submit" value="Next" />
> </td>
> </tr>
> </table>
> </form>
>
>
> Output Page
> ------------------
>
> <%
> Dim rsResults__MMColParam
> rsResults__MMColParam = "1"
> If (Request.Form("fldYear") <> "") Then
> rsResults__MMColParam = Request.Form("fldYear")
> End If
> %>
> <%
> Dim rsResults__MMColParam2
> rsResults__MMColParam2 = "1"
> If (Request.Form("fldMonth") <> "") Then
> rsResults__MMColParam2 = Request.Form("fldMonth")
> End If
> %>
> <%
> Dim rsResults
> Dim rsResults_numRows
>
> Set rsResults = Server.CreateObject("ADODB.Recordset")
> rsResults.ActiveConnection = MM_connection_STRING
> rsResults.Source = "SELECT * FROM tblDaily WHERE fldYear AND fldMonth = "
> +
> Replace(rsResults__MMColParam, "'", "''") + " ORDER BY fldDay ASC"
> rsResults.CursorType = 0
> rsResults.CursorLocation = 2
> rsResults.LockType = 1
> rsResults.Open()
>
> rsResults_numRows = 0
> %>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines