Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP syntax questions...please help...desperate!

Status
Not open for further replies.

angelleye

Technical User
Feb 4, 2003
36
US
I’m using ASP to generate an XML file. The variables that I'm creating in ASP are to be used to populate the final XML output.

When the ASP page first comes in, I already have a filter on my recordset:

SELECT *
FROM avgDaysOB
WHERE TERM = 'MMColParam'

and MMColParam = Request.QueryString("TERM")

It takes the TERM from a form on a previous page where you type in which TERM you want to generate the XML file for.

So let's say I typed in the TERM DAL (Dallas, TX). My recordset on the generating page would now consist of every record in the table where the TERM = DAL. What this does, is pulls 55 records. (this is not set for every TERM, but is usually the amount returned) The 55 records have the 3 fields: TERM STATE and NUMDAYS

TERM, of course, in this recordset is always DAL. So the way the table would be setup is like this:

TERM STATE NUMDAYS
DAL AL 2.4
DAL AR 2.2
DAL AZ 2.6
.
.
.

There would be a record for every U.S. State and Most of the Canadian Provinces. What this shows is how long (avg days) it takes to get to the specified STATE from the specified TERM. For example, above, it takes an avg. of 2.4 days to get to AL (alabama) from DAL (Dallas, TX)

What I am trying to do at this point is take the numbers from the NUMDAYS column and place them into ASP variables. For example:

dim AL 'creates my ASP variable to hold the value of NUMDAYS for AL
AL = ??????? 'THIS IS WHAT I DON'T KNOW.

What it needs to equal is the value that shows for the state of AL in the NUMDAYS column from my recordset.

I was trying to use:

AL = (rsOBData.Fields.Item("TERM OB").Value) where (rsOBData.Fields.Item("STATE").Value) = "AL")

with no success. If anybody can help me out with this I would MUCH appreciate it.

Thanks!

Drew
 
To get your example to work, you can (my syntax may be slightly off, not at work right now):
case select rsOBData.Fields.Item("STATE").Value:
when "AL"
AL = rsOBData.Fields.Item("TERM OB").Value
...etc...
end select

Though that would be kind of obnoxious to have over 50 variables and over 50 entries in the case statement.

You could also look into creating an array of the information. Jessica [ponytails2]
 
I've been reading about different ways to go about this. I've come across both the array's and the case select thing you've talked about here.

From what I've ready I do think the best way to go about it would be to do the array. But I'm afraid I'm not totally understanding how that works. If it would be possible to get a look at the way the code would look with my example that'd be awsome. Or any good sources...or anything at all would be great!

Thanks!
 
Can you tell me what you're trying to do with the data once you get it into either variables or an array? Jessica [ponytails2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top