Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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
  #1 (permalink)  
Old July 29th, 2006, 01:50 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL Not Working

The following SQL does not work:
Code:
myMin = CInt(Request("minAge"))
myMax = CInt(Request("maxAge"))

mySQLb = "SELECT * From tbl_bro WHERE BrAge >='" & myMin & "' AND BrAge <='" & myMax & "'"

AND

mySQLb = "SELECT * FROM tbl_bro WHERE  BrAge BETWEEN " & myMin & " AND " & myMax & ";"
But this works:
Code:
mySQLb = "SELECT * FROM tbl_bro WHERE  BrAge BETWEEN 18 AND 50"
myRS.Open mySQLb, myCon
Anything obvious?

  #2 (permalink)  
Old July 29th, 2006, 06:57 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Are your variables actually getting assigned a value?

"The one language all programmers understand is profanity."
  #3 (permalink)  
Old July 29th, 2006, 07:47 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm...

Tried it:
Code:
<%= myMin %>
&
<%= myMax %>
And the VALUES come through OK.
  #4 (permalink)  
Old August 5th, 2006, 08:29 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: , , .
Posts: 198
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via MSN to itHighway
Default

Check 'BrAge' Field type in database. If it is a numeric field then use following sql

mySQLb = "SELECT * From tbl_bro WHERE BrAge >=" & myMin & " AND BrAge <=" & myMax
AND

mySQLb = "SELECT * FROM tbl_bro WHERE BrAge BETWEEN " & myMin & " AND " & myMax


Hope this helps



Similar Threads
Thread Thread Starter Forum Replies Last Post
my website working but its down coz ms sql naeem.net ASP.NET 2.0 Professional 5 October 10th, 2008 03:45 PM
SQL In book not working bgcsocal SQL Server 2005 3 August 5th, 2008 12:54 PM
sql query not working !! SPadmalwar SQL Server 2000 5 July 15th, 2006 12:41 AM
How Can SQL Server working with ASP??? aliasp SQL Server ASP 1 March 18th, 2004 03:13 PM





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