Solved

Basic (newbie) ASP question?

Posted on 1998-07-20
4
170 Views
Last Modified: 2010-05-03
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
0
Comment
Question by:bhummel
  • 2
4 Comments
 

Author Comment

by:bhummel
ID: 1466250
Edited text of question
0
 
LVL 2

Accepted Solution

by:
Jagar earned 100 total points
ID: 1466251
You have a form on the first screen with the action property set to the second page that you want to process the selection from the list.  Then in the second page you use a statement like the following

criteria = Request.Form("Combo1")
0
 

Expert Comment

by:mario_ba
ID: 1466252
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
0
 

Author Comment

by:bhummel
ID: 1466253
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

861 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