Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2005, 10:01 AM
Authorized User
 
Join Date: May 2005
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Problem with multiple values

HI,

I am working on a dynamic query and for the most part it is working - however - in the form users have the ability to select multiple values in any particular column - the problem is that when multiple values are selected the query fails to return any results - when only one value per column is slected results will be retrieved. I have been trying to work with an IN statement to have it parse the multiple values - but I have probably messed up somewhere:

Here is the code:

sqlstr = "SELECT * FROM tblsamples WHERE Date_Stored BETWEEN #" + rssample__varstorefrom + "# AND #" + rssample__varstoreto + "#"

rssample__vartower = "*"
If (Request.Form("tower") <> "") Then
  rssample__vartower = Request.Form("tower")
    If rssample__vartower <> "*" then
        sqlstr= sqlstr + " and Tower IN('" + rssample__vartower + "') "
    End if
End If

Here is the SQL string that is passed to the page:

SQL is SELECT * FROM tblsamples WHERE Date_Stored BETWEEN #01/01/2005# AND #06/27/2005# and Tower=('01, 02, 03')

by the way - the database is setup so that the field Tower is a text field.

Any help would be appreciated - I am still very new to asp programming

Chris

 
Old June 28th, 2005, 11:49 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I may be missing something here, but aren't we trying to solve that problem here: http://p2p.wrox.com/topic.asp?TOPIC_ID=32056

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple values in "IN" clause - Please help! billkrieger ASP.NET 1.0 and 1.1 Professional 5 October 22nd, 2007 05:23 PM
problem sending values into SQL Server Proc lisabb ASP.NET 2.0 Basics 2 May 23rd, 2007 01:19 PM
Problem writing multiple values to registery method VB How-To 1 June 20th, 2006 10:49 PM
How t o insert multiple values qazi_nomi Access ASP 2 May 3rd, 2005 12:45 AM
Listboxes with Multiple Values joanncae BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 October 13th, 2003 12:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.