Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-05-2008, 03:22 PM
Andy
 
Posts: n/a
SQL Help Needed

Hi
I'm struggling with this sql statement and hope someone can help me out.
Im running dw 8 in Classic ASP and Access DB

I have a search page and a results page.
My search page has several dropdown menus that pass values to my results
page.

I want my results page to display results for ANY of the values passed from
my search page and not depend on all values.
So if a visitor only makes selections from two or three dropdown options, i
get results based on those selections.

At present im thinking that my results page needs all values as i use the
AND in my select statement. Is this correct? if so how do i achieve my
goal??

Thank You
Andy

I have my results page sql select code below:

<%
Dim RSResults__MMColParam2
RSResults__MMColParam2 = "0"
If (Request("location") <> "") Then
RSResults__MMColParam2 = Request("location")
End If
%>
<%
Dim RSResults__MMColParam3
RSResults__MMColParam3 = "0"
If (Request("Instrument") <> "") Then
RSResults__MMColParam3 = Request("Instrument")
End If
%>
<%
Dim RSResults__MMColParam4
RSResults__MMColParam4 = "0"
If (Request("Person") <> "") Then
RSResults__MMColParam4 = Request("Person")
End If
%>
<%
Dim RSResults__MMColParam5
RSResults__MMColParam5 = "0"
If (Request("AssetID") <> "") Then
RSResults__MMColParam5 = Request("AssetID")
End If
%>
<%
Dim RSResults__MMColParam6
RSResults__MMColParam6 = "0"
If (Request("Description") <> "") Then
RSResults__MMColParam6 = Request("Description")
End If
%>
<%
Dim RSResults__MMColParam7
RSResults__MMColParam7 = "0"
If (Request("TestStatus") <> "") Then
RSResults__MMColParam7 = Request("TestStatus")
End If
%>
<%
Dim RSResults__MMColParam8
RSResults__MMColParam8 = "0"
If (Request("TestType") <> "") Then
RSResults__MMColParam8 = Request("TestType")
End If
%>
<%
Dim RSResults__MMColParam9
RSResults__MMColParam9 = "0"
If (Request("FromDate") <> "") Then
RSResults__MMColParam9 = Request("FromDate")
End If
%>
<%
Dim RSResults__MMColParam10
RSResults__MMColParam10 = "0"
If (Request("ToDate") <> "") Then
RSResults__MMColParam10 = Request("ToDate")
End If
%>
<%
Dim RSResults
Dim RSResults_numRows

Set RSResults = Server.CreateObject("ADODB.Recordset")
RSResults.ActiveConnection = MM_calcert_STRING
RSResults.Source = "SELECT DISTINCT Assets.[Asset ID], Assets.Description,
Locations.[Location Name], [Asset Tests].[Test Date], [Asset Tests].[Test
Instrument Serial No], [Asset Tests].User, [Asset Test Records].[Test Type],
[Asset Test Records].Value, [Asset Test Records].Unit, [Asset Test
Records].[Passed Test] FROM Locations INNER JOIN ((Assets INNER JOIN [Asset
Tests] ON Assets.[Asset Key] = [Asset Tests].[Asset ID]) INNER JOIN [Asset
Test Records] ON [Asset Tests].[Test ID] = [Asset Test Records].[Test ID])
ON Locations.ID = Assets.Location WHERE Locations.[Location Name] = '" +
Replace(RSResults__MMColParam2, "'", "''") + "' AND [Asset Tests].[Test
Instrument Serial No] = '" + Replace(RSResults__MMColParam3, "'", "''") + "'
AND [Asset Tests].User = '" + Replace(RSResults__MMColParam4, "'", "''") +
"' AND Assets.[Asset ID] = '" + Replace(RSResults__MMColParam5, "'", "''")
+ "' AND Assets.Description = " + Replace(RSResults__MMColParam6, "'",
"''") + " AND [Asset Test Records].[Passed Test] = '" +
Replace(RSResults__MMColParam7, "'", "''") + "' AND [Asset Test
Records].[Test Type] = " + Replace(RSResults__MMColParam8, "'", "''") + "
AND [Asset Tests].[Test Date] BETWEEN '" + Replace(RSResults__MMColParam9,
"'", "''") + "' AND '" + Replace(RSResults__MMColParam10, "'", "''") + "'
ORDER BY Assets.[Asset ID] ASC"
RSResults.CursorType = 0
RSResults.CursorLocation = 2
RSResults.LockType = 1
RSResults.Open()

RSResults_numRows = 0
%>



Reply With Quote
  #2 (permalink)  
Old 08-05-2008, 03:49 PM
bregent
 
Posts: n/a
Re: SQL Help Needed

Change AND to OR.
Reply With Quote
  #3 (permalink)  
Old 08-07-2008, 04:22 PM
Andy
 
Posts: n/a
Re: SQL Help Needed

Of course.....(embarrassed)
Thanks Bregent

"bregent" <webforumsuser@macromedia.com> wrote in message
news:g79p9g$mgj$1@forums.macromedia.com...
> Change AND to OR.



Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Software > Adobe Software > Dreamweaver


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:39 AM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Remortgages | Credit Counseling | Company Reports | Mortgage Loans | Mortgage Calculator



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114