Link to home
Start Free TrialLog in
Avatar of bhummel
bhummel

asked on

Basic (newbie) ASP question?

Greetings,
I have been working with VB for a number of years and am starting to use ASP. My question is:

How do I carry the value of a drop down list (a list of company's) in an ASP page to a second results page. I just need the syntax for applying the Company criteria to the second recordset.

It's probably very easy, at least it is in Cold Fusion, but I want to learn the ASP way of doing things.

Thanks,
Brad
Avatar of bhummel
bhummel

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of Jagar
Jagar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi brad
If your Dropdownlist has a name and your form has the method "post", you only have to submit the form and on the results page, you can get the the value of the DD with folowing code:

x = Request.QueryString("[Listname]")

If you had an multiple DD the values are seperated with ","
Ciao mario
Avatar of bhummel

ASKER

Thanks for your help.

I seem to be having some problems connecting the 2 pages though. Each time I run this I get a no records found.

The problem is when I try to add x, or criteria to the WHERE clause of the SQL.

<%      
      Set DataConn = Server.CreateObject("ADODB.Connection")
      DataConn.Open "DSN=Contacts", "webuser", "webuser"

      criteria = Request.Form("Combo1") **Name of Form**
        or
        criteria = Request.QueryString("CompanyName")
        ** I've tried both **

      q2 = "SELECT CompanyName, Dear, FirstName ,LastName, WorkPhone, EMailName FROM Contacts WHERE CompanyName = 'criteria'"
       Set rs2 = DataConn.Execute (q2)
      ary = rs2.GetRows(5) **Used for my table formatting**
      rs2.close      
%>

Each time I call resuls.asp I get a no records found. When I know records exist.

What am I doing wrong?

Thanks,
Brad