Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 03-01-2005, 06:13 PM   #1
Beta Member
 
Join Date: Mar 2005
Posts: 1
Default results of query not displaying

If someone does a search on my site, they only get very limited results in "XREF" (or unit 8) and NO results in the other units - 3, 28 & 29. In the database all they keywords are located in "content" table. Can someone tell what is wrong? If I'm in the wrong forum, please let me know which forum to go to. Thanks!

This is part of the keywordresponse.asp file.

<%
Dim varKeywords
Dim strSQLKeywords
Dim objConn
Dim objRecKeywords
Dim intCount
Dim varUnitID
Dim varSiteID
Dim varSubjectID
Dim strSQLUnit
Dim objRecUnit
Dim tempArray


tempArray = Split(Request.Form("SiteID"),"|")



' set the values for the SiteID
varSiteID = tempArray(0)
varPageID = tempArray(1)

Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=hrib;uid=paul.marcotte;pw=bT2du8Yg;"

' SQL Statement to find the unit
strSQLUnit = "SELECT UnitID FROM Sites WHERE SiteID = " & varSiteID & ";"

' create and open the Unit recordset
Set objRecUnit=Server.CreateObject("ADODB.Recordset")
objRecUnit.Open strSQLUnit, objConn, adOpenStatic, adLockReadOnly, adCmdText

' set the value for the UnitID
varUnitID = objRecUnit("UnitID")

' convert keywords to lowercase
varLCKeywords = lCase(Request.Form("Keywords"))
' strip out apostrophies
varLCKeywords = Replace(varLCKeywords, "'", "''")

' convert keywords to lowercase
varUCKeywords = Request.Form("Keywords")
' strip out apostrophies
varUCKeywords = Replace(varUCKeywords, "'", "''")


' sql statements

' generate SQL statement based on Site ID
If varSiteID = 8 Then

strSQLKeywords= "SELECT XrefMemos.MemoNumber, XrefMemos.MemoTitle, XrefMemos.MemoDate, " & _
"XrefMemos.IndexNumber " & _
"FROM XrefMemos INNER JOIN Subjects ON " & _
"XrefMemos.IndexNumber = Subjects.IndexNumber " & _
"WHERE XrefMemos.MemoKeywords LIKE '% " & varLCKeywords & "%' " & _
"OR XrefMemos.MemoTitle LIKE '%" & Trim(varUCKeywords) & "%' " & _
"OR Subjects.SubjectName LIKE '%" & Trim(varUCKeywords) & "%' " & _
"GROUP BY XrefMemos.MemoNumber, XrefMemos.MemoTitle, XrefMemos.MemoDate, " & _
"XrefMemos.IndexNumber " & _
"ORDER BY XrefMemos.MemoDate DESC;"

ElseIf varSiteID = 3 OR varSiteID = 28 OR varSiteID = 29 Then

strSQLKeywords= "SELECT Subjects.SubjectID, Subjects.SubjectName, " & _
"Content.ContentDate " & _
"FROM Subjects, Content " & _
"WHERE Subjects.PageID = " & varPageID & " " & _
"AND Content.SubjectID = Subjects.SubjectID " & _
"AND Content.Keywords LIKE '% " & varLCKeywords & "%' " & _
"ORDER BY Content.ContentDate DESC;"

End If

' objRecKeywords.CursorLocation = 3 adUseClient
Set objRecKeywords=Server.CreateObject("ADODB.Recordse t")
objRecKeywords.Open strSQLKeywords, objConn, adOpenStatic

' count the records found
intCount = objRecKeywords.Recordcount

%>

<%
' return results to user
If intCount > 0 Then
If varSiteID = 8 Then
Response.Write "<p><strong>" & intCount & " memo(s) found matching the above keyword(s).</strong></p>"

While Not objRecKeywords.EOF
Response.Write "<p><strong>Memo: <a href='/EPB/Memo.asp?UnitID=" & varUnitID & "&SiteID=" & varSiteID & "&MemoNumber=" & objRecKeywords("MemoNumber") & "'>" & objRecKeywords("MemoNumber") & "</a></strong><br>" & vbCrLf
Response.Write "<strong>Index:</strong>" & objRecKeywords("IndexNumber").value & "<br>" & vbCrLf
Response.Write "<strong>Date:</strong>" & objRecKeywords("MemoDate") & "<br>" & vbCrLf
Response.Write "<strong>Subject:</strong> " & objRecKeywords("MemoTitle") & "</p>"
objRecKeywords.MoveNext
Wend
ElseIf varSiteID = 3 OR varSiteID = 28 OR varSiteID = 29 Then
Response.Write "<p><strong>" & intCount & " instance(s) found matching the above keyword(s).</strong></p>"

While Not objRecKeywords.EOF
Response.Write "<p><strong>Date:</strong>" & objRecKeywords("ContentDate") & "<br>" & vbCrLf
Response.Write "<strong>Subject: <a href='Content.asp?UnitID=" & varUnitID & "&SiteID=" & varSiteID & "&SubjectID=" & objRecKeywords("SubjectID").value & "&kw=" & Server.URLEncode(Trim(varUCKeywords)) & "'>" & objRecKeywords("SubjectName").value & "</a></strong></p>" & vbCrLf
objRecKeywords.MoveNext
Wend



ElseIf varSiteID = 7 Then



End If

Else

Response.Write "<p>No documents were found matching these keywords. Please revise your keywords and try again."

End If
%>
eddie is offline   Reply With Quote
Reply

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

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



All times are GMT -5. The time now is 01:53 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0