![]() |
|
|||||||
|
|
||||||||
|
|
|
|
|
|
||||
|
|
|
|
|
|||||
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
| Home | Contacte-nos | Arquivo | Comentários | Páginas relacionadas | REDI | SARDC |
|
|
<%
Dim adoCon
Dim strCon
Dim strSQL
Dim rsResults
Dim intRecordPositionPageNum
Dim intRecordLoopCounter
Dim lngTotalRecordsFound
Dim lngTotalNumPages
Dim intLinkPageNum
Dim intLoopCounter
Dim sarySearchWord
Dim strSearchKeywords
Dim intSQLLoopCounter
Dim intSearchWordLength
Dim blnSearchWordLenthOK
Dim intRecordDisplayFrom
Dim intRecordDisplayedTo
Dim strName
Dim strAcronym
Dim strType
Dim strPhysical
dim strpostal
Dim strTel
Dim strContact
Dim strEmail
Dim strFax
Dim strUrl
Dim strContactTitle
Dim strProfile
Dim strInitiatives
Dim strFocus
Dim strMajorKeys
Dim strOtherKeys
Dim strAdd
Dim strCriteria
Dim strCountry
Dim strSearch
strSearch = Request.QueryString("Search")
If Request.QueryString("PagePosition") = "" Then
intRecordPositionPageNum = 1
'Else the page has been displayed before so the page postion is set to the Record Position number
Else
intRecordPositionPageNum = CInt(Request.QueryString("PagePosition"))
End If
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsResults = Server.CreateObject("ADODB.Recordset")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};"
strCon = strCon & "DBQ=" & Server.MapPath("sanf")
adoCon.open strCon
'Read in all the search words into one variable
If Request.QueryString("Submit2") = "Search" Then
strSearchKeywords = Trim(Request.QueryString("search"))
Else
strSearchKeywords = Trim(Request.QueryString("Keywords2"))
end if
'If the use has not entered a value then let the search words variable contain a space (chr10)
If strSearchKeywords = "" Then strSearchKeywords = chr(10)
'Replace any less than or greater than signs with the HTML equivalent (stops people entering HTML tags)
strSearchKeywords = Replace(strSearchKeywords, "<", "<")
strSearchKeywords = Replace(strSearchKeywords, ">", ">")
strSearchKeywords = Replace(strSearchKeywords, "'", "''")
'Read in the search words to be searched
sarySearchWord = Split(Trim(strSearchKeywords), " ")
'Return the tow '' back to one' for displaying on the screen
strSearchKeywords = Replace(strSearchKeywords, "''", "'")
'Initalise the word search length variable
blnSearchWordLenthOK = True
'Loop round to check that each word to be searched has more than the minimum word length to be searched
For intLoopCounter = 0 To UBound(sarySearchWord)
'Initialise the intSearchWordLength variable with the length of the word to be searched
intSearchWordLength = Len(sarySearchWord(intLoopCounter))
'If the word length to be searched is less than or equal to min word length then set the blnWordLegthOK to false
'If intSearchWordLength <= 2 Then
' blnSearchWordLenthOK = False
'End If
Next
strSQL = "SELECT * FROM port WHERE Title LIKE '%" & sarySearchWord(0) & " %'"
'Loop to search for each search word entered by the user
For intSQLLoopCounter = 0 To UBound(sarySearchWord)
strSQL = strSQL & " OR body LIKE '%" & sarySearchWord(intSQLLoopCounter) & "%'"
Next
strSQL = strSQL & " ORDER By volume DESC"
'Order the search results by the number of click through hits decending (most popular sites first)
'strSQL = strSQL & " ORDER By JobID DESC;"
rsResults.open strSQL,strCon,3
lngTotalRecordsFound = CLng(rsResults.RecordCount)
rsResults.PageSize = 10
'Get the page number record poistion to display from
IF NOT rsResults.EOF Then rsResults.AbsolutePage = intRecordPositionPageNum
'Count the number of pages the search results will be displayed on calculated by the PageSize attribute set above
lngTotalNumPages = CLng(rsResults.PageCount)
'Calculate the the record number displayed from and to on the page showing
intRecordDisplayFrom = (intRecordPositionPageNum - 1) * 10 + 1
intRecordDisplayedTo = (intRecordPositionPageNum - 1) * 10+ 10
If intRecordDisplayedTo > lngTotalRecordsFound Then intRecordDisplayedTo = lngTotalRecordsFound
If lngTotalRecordsFound > 0 Then
Response.write("Your Search for " & strSearchkeywords & " returned " & lngTotalRecordsFound & " results. Displaying records " & intRecordDisplayFrom & " - " & intRecordDisplayedTo & " ") Else Response.write("Your Search for " & strSearchkeywords & " did not match any articles ") Response.write("
")
End If
For intRecordLoopCounter = 1 to 10
%>
<%
If Not rsResults.EOF Then
Response.Write("" & rsResults("Title") & "")
Response.Write(" ", " ") a = Split(a," ")
Response.Write(" ") rsResults.MoveNext End If Next 'If there are more pages to display then add a title to the other pages If intRecordPositionPageNum > 1 OR NOT rsResults.EOF AND blnSearchWordLenthOK = True Then 'Display an HTML table with links to the other search results Response.Write vbCrLf & "
" End If 'End If 'Close Server Objects Set rsResults = Nothing Set strCon = Nothing Set adoCon = Nothing %>
|
|
|
SADC Today
|
|
Any comments or queries about the content of this page,
contact sadctoday@sardc.net Comments and queries regarding the page itself, contact the Web Applications Developer. |
|