Skip to main content
Participant
May 10, 2006
Question

Trying to add another variable to an asp application

  • May 10, 2006
  • 5 replies
  • 465 views
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!

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Inspiring
May 11, 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
> %>
>


hutch1980Author
Participant
May 11, 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.