for mange db'udtræk i søgning
Morg'n EHvorfor udtrækker denne søgekode, lige meget hvad jeg søger efter, alle 19 rækker i db'en?
kode:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<% Response.Buffer = true %>
<html>
<head>
<title>Resultat af søgning</title>
</head>
<body BGCOLOR="#808080" TEXT="#ffffff" VLINK="#Ffffff" LINK="#Ffffff" ALINK="#06438A" leftmargin="130">
<p align="center">
<b>
<font size=6 color="#000000">Resultat af søgning</font>
</b>
<font size=2 color="#ffffff">
<br>
<%
Dim Strfritekst
Dim Strarbet
Dim Strtom
Dim Strogsimpel
strfritekst = Request.querystring("fritekst")
strarbet = Request.querystring("arbet")
strogsimpel = Request.querystring("ogsimpel")
strtom = Strfritekst + strarbet
If Len(strtom) = 0 Then
Response.Clear
Response.Redirect("default.asp")
Else
strfritekst = Replace(strfritekst,"'","''")
strarbet = Replace(strarbet,"'","''")
strsimpel = Replace(strogsimpel,"'","''")
End If
strSQL = "SELECT * FROM status"
If Len(strfritekst) > 0 THEN
strSQL = strSQL & " WHERE ((S_lokation LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_stelnr LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_enhed LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_bem LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_plan_dato LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_ind_dato LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_ud_dato LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_FCF LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_V_NT_Egress LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_V_NT_Vaaben LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_V_NT_Dinghy LIKE '%" & strfritekst & "%')"
strSQL = strSQL & " OR (S_V_NT_stel LIKE '%" & strfritekst & "%'))"
End if
If Len(strarbet) > 0 Then
If strogsimpel = "og" then
strSQL = strSQL & " AND (S_stelnr LIKE '%" & strarbet & "%')"
End if
If strogsimpel = "eller" then
strSQL = strSQL & " OR (S_stelnr LIKE '%" & strarbet & "%')"
End if
If strogsimpe = "ikke" then
strSQL = strSQL & " AND NOT (S_stelnr LIKE '%" & strarbet & "%')"
End if
End if
strSQL = strSQL & " ORDER BY S_stelnr"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + Server.MapPath("/data/f16.mdb") + ";" )
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open strSQL, Conn, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 20
intRecCount = rs.PageSize
intPageCount = rs.PageCount
intPage = Request.querystring("page")
If isNumeric(intPage) = False Or intPage < 1 Then
count = 1
intPage = 1
else
count = ((intPage - 1) * rs.PageSize) + 1
End If
rs.AbsolutePage = intPage
AntalP = rs.RecordCount
Response.write "<p><b>Din søgning resulterede i " & AntalP & " afonds<br></b></p>"
Response.Write "<p><b>Side " & intPage & " af " & intPageCount & "</b></p><br>"
Response.Write "<table border='5' "
Response.Write " cellPadding='0' "
Response.Write " cellSpacing='0'>"
Response.Write "<tr><th>Nr.</th><th>A-fond</th><th>Arkivbetegnelse</th></tr>"
Do While Not rs.EOF And intRecCount > 0
Response.Write "<tr><td><font face='arial' size='2'>" & count & ".</font></td>"
REsponse.write "<td><a href='fuldpost.asp?id=" & rs("StatusID") & "' target='_blank'><font face='arial' size='2'>" & rs("S_stelnr") & "</font></a></td>"
Response.Write "<td><a href='fuldpost.asp?id=" & rs("StatusID") & "' target='_blank'><font face='arial' size='2'>" & rs("S_lokation") & "</font></a></td></tr>"
intRecCount = intRecCount - 1
rs.MoveNext
count=count+1
Loop
response.write "</table>"
End if
If rs.recordcount = 0 then
Response.Write "<br><br><br><br><b><font size=3>Der er ikke fundet nogle afonds, prøv igen</b><br><br>"
%>
<p align="center"><a href="java script:history.go(-1)"><font color="#000000"><b>Tilbage</b></font></a></p>
<%
else
rs.Close
Set rs = Nothing
Dim PrevPage, NextPage
PrevPage = intPage - 1
NextPage = intPage + 1
Response.Write "<p>Gå til side "
For intNum = 1 To intPageCount
Response.Write "<a href=sog1.asp?ogsimpel=" & strogsimpel &"&fritekst=" & strfritekst & "&arbet=" & strarbet &"&page=" & intNum & ">" & intNum & "</a> "
Next
Response.Write "<p>"
If Clng(intPage) > 1 Then
Response.Write "<a href=sog1.asp?ogsimpel=" & strogsimpel &"&fritekst=" & strfritekst & "&arbet=" & strarbet &"&page=" & PrevPage & "><<</a>"
Else
Response.Write "<<"
End If
Response.Write " "
If Clng(intPage) < Clng(intPageCount) Then
Response.Write "<a href=sog1.asp?ogsimpel=" & strogsimpel &"&fritekst=" & strfritekst & "&arbet=" & strarbet &"&page=" & NextPage & ">>></a>"
Else
Response.Write ">>"
End If
End if
%>
</font>
</body></html>
