navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

ASP Database queries from multiple selections in forms

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP Database queries from multiple selections in forms
Page: [1]
 
Guest


 
ASP Database queries from multiple selections in forms - 3/9/2001 18:09:00   
Hi,

I am new to web programming, and to your forum. But, I keep coming back here for answers to questions, so I thought it was time to post my own.

I am trying to pass the results from a multiple selection form to a fp_sQry= "SELECT..." query in an *.asp page. If the parameter coming in is numeric, my code works fine. If the parameter coming in is text, I can't get it to work.

Here's the query:

strQry = " SELECT *
" FROM Air_Obs " & _
" WHERE ((Air_Obs.Site_ID IN (::Site_ID: " & _
" AND (Air_Obs.Parameter_ID IN ('::Parameter_ID::') " & _
" AND (Air_Obs.Obs_Date BETWEEN #::StartDate::# AND #::EndDate::#))"

Site_ID IN (::Site_ID: is numeric and works like a charm. However, Parameter_ID is being sent as a comma delineated string without the single quotes around the text (BSO4, Si, Cl). I think the query wants it to be ('BSO4', 'Si', 'Cl'). How do you get this relatively simple query to work properly? It will work if I only make one selection, and when I hard code some values into the query (obviously not what I need!).

Any help would be greatly appreciated. My head is sore from banging it against my monitor...

Monica

Spooky

 

Posts: 26599
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: ASP Database queries from multiple selections in forms - 3/9/2001 22:14:00   
The trick here is to remember that the return from a comma delimited form looks like :
BSO4, Si, Cl
and not :
'BSO4', 'Si', 'Cl'

So youll have to be tricky and make sure your form fields are given values of

'BSO4' 'Si' and 'Cl' etc

Now your query looks like :

(Air_Obs.Parameter_ID IN (::Parameter_ID:

Make sense?!

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to Guest)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> ASP Database queries from multiple selections in forms
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts