Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Create Variable to add into SQL Statement?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Create Variable to add into SQL Statement?

 Post Reply Post Reply Page  <12
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 15 February 2010 at 4:18pm
I tried changing the link like you said, but now it seems to bring up random results. Sometimes, depending on the serial number, it doesn't even bring up the serial number that I clicked.

Here is a picture of my database.


I hope this identifies why I'm not getting the expected results.

Thanks for your help.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2010 at 6:39pm
For now I am using the original solution. It works well enough, but I would really love to find a way to check the whole database for a match. 

Another question: How can I display the number of results found in the database?

Thanks!
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2010 at 5:58pm
Your DB seems to use a mix of upper and lower case serial numbers.
VBA, the language used by the MS Access program itself, is not case sensitive.
ASP however is case sensitive. When using ASP to compare two fields pulled from an Access DB, you need to force the comparison to either compare both fields as upper or lower case using either UCase or LCase.


Field1 = "a"
Field2 = "A"

"If Field1 = Field2"                         will compare as FALSE
"If UCase(Field1) = UCase(Field2)"   will compare as TRUE
"If LCase(Field1) = LCase(Field2)"    will compare as TRUE




Lead me not into temptation... I know the short cut, follow me.
Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 07 April 2010 at 6:23pm
Is there a way that I can, after going to the results page, click on another link to filter the information displayed even further? For instance, I'm looking at every entry containing this serial number, then I want to click on whatever category I desire. 

I am using this same code for another website when we list all of our assets. On the main page I have a menu where the user can select which site to view. If they click "Ontario", 
<a href="location.asp?LocDisplay=Ontario">Ontario</a>

They are then taken to a page that displays only the assets located in Ontario.

SELECT * FROM assets WHERE Location LIKE '"&request.querystring("LocDisplay")&"'

On this page, there is another menu where they can filter the results further by selecting a specific type of device, such as Desktop, Laptop, Server, Monitor, etc.

I would like to make the links on this menu take the user to another page (or stay on this one if possible) where they will view just the Desktops (or whatever they click) from that specific location. 

I want to pull the LocDisplay variable and insert it into the link, followed by a variable for the type of device clicked.

Right now, I am testing this out by entering the link as follows:

<a href="location_device.asp?LocDisplay=Ontario?DeviceDisplay=Desktop">Desktops</a>

This will open the location_device.asp page, but no data is displayed.

The SQL statement is like so:
SELECT * FROM assets WHERE Location LIKE '"&request.querystring("LocDisplay")&"' AND DeviceType LIKE 

'"&request.querystring("DeviceDisplay")&"'

What am I doing wrong? I'm sure it has to be something I did in the link.

Thanks!
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.