Tæl funde poster ved søgning
<%Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=SM", adopenstatic
if Request.Form("valg") = "Søg på alt" then
SQL = "SELECT DISTINCT nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov FROM [qrySM] WHERE [qrySM].[nummer] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmpdate1] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmpdate2] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[resume] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmpmyndighed] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmpstikord] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmplov] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[tmpBekendt] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[Resume] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[Sagsfremstilling] LIKE '%" & Request.Form("search") & "%' OR [qrySM].[Afgoerelse] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Afgørelse truffet af" then
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, tmpmyndighed FROM [qrySM] WHERE [qrySM].[tmpmyndighed] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Journal nr." then
SQL = "SELECT distinct nummer, tmpmyndighed, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, nummer FROM [qrySM] WHERE [qrySM].[tmpmyndighed] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Afgørelsesdato" then
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov FROM [qrySM] WHERE [qrySM].[tmpdate1] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Udsendelsesdato" then
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpdate2 tmpstikord, tmplov FROM [qrySM] WHERE [qrySM].[tmpdate2] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Meddelelse nr." then
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov FROM [qrySM] WHERE [qrySM].[nummer] LIKE '%" & Request.Form("search") & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Meddelelse om" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND tmpstikord LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR tmpstikord LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, tmpstikord FROM [qrySM] WHERE [qrySM].[tmpstikord] LIKE '%" & strSearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Lov" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND tmplov LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR tmplov LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov FROM [qrySM] WHERE [qrySM].[tmpLov] LIKE '%" & strsearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Bekendtgørelse" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND tmpbekendt LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR tmpbekendt LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, tmpbekendt FROM [qrySM] WHERE [qrySM].[tmpbekendt] LIKE '%" & strsearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Resume" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND resume LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR resume LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, resume FROM [qrySM] WHERE [qrySM].[Resume] LIKE '%" & strsearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Sagsfremstilling" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND sagsfremstilling LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR sagsfremstilling LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, sagsfremstilling FROM [qrySM] WHERE [qrySM].[sagsfremstilling] LIKE '%" & strsearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
if Request.Form("valg") = "Afgørelse" then
strSearch = Trim(Request.Form("search"))
strSearch = Replace(strSearch, " AND ", "§AND§")
strSearch = Replace(strSearch, " OR ", "§OR§")
strSearch = Replace(strSearch, " and ", "§AND§")
strSearch = Replace(strSearch, " or ", "§OR§")
strSearch = Replace(strSearch, " ", "§AND§")
strSearch = Replace(strSearch, "§AND§", "%' AND afgoerelse LIKE '%")
strSearch = Replace(strSearch, "§OR§", "%' OR afgoerelse LIKE '%")
SQL = "SELECT distinct nummer, socialmeddelelseid, tmpdate1, tmpstikord, tmplov, afgoerelse FROM [qrySM] WHERE [qrySM].[afgoerelse] LIKE '%" & strsearch & "%' ORDER BY [qrySM].[tmpdate1]"
end if
set Result = Conn.Execute(SQL)
if request.form("search") = "" then
Response.Write "<table width=400><tr><td><span class=text>Du har ikke indtastet et søgeord</P><P><A HREF=search_sm.htm>Prøv igen</A></SPAN></tr></td></table>"
elseif Result.Eof then
Response.Write "<table width=400><tr><td><span class=text>Din søgning gav desværre intet resultat</P><P><A HREF=search_sm.htm>Prøv med en bredere søgning</A></SPAN></tr></td></table>"
else
Response.Write "<table width=400 border=0 cellpadding=4 cellspacing=0><tr><td bgcolor=#C2B26A><span class=text>Din søgning gav følgende resultat (sorteret efter afgørelsesdato):</SPAN></td></tr></table>"
do while not Result.Eof
Response.Write "<table border=""0"" width=""400"" bgcolor=#EFEAD6>"
Response.Write "<tr><td width=""300"">" & "<span class=text><b>Meddelelse nr.:</b> " & Result("nummer") & "</SPAN></td></tr>"
Response.Write "<tr><td width=""300"">" & "<span class=text><b>Afgørelsesdato:</b> " & Result("tmpdate1") & "</SPAN></td></tr>"
Response.Write "<tr><td width=""300"">" & "<span class=text><b>Meddelelse om:</b> " & Result("tmpstikord") & "</SPAN></td></tr>"
Response.Write "<tr><td width=""300"">" & "<span class=text><b>Lov:</b> " & Result("tmpLov") & "</SPAN></td></tr>"
Response.Write "<tr><td width=""300"">" & "<span class=text><a href=sm.asp?ID=" & Result("socialmeddelelseID") & ">" & "Læs SM" & " <img src=../images/link.gif border=0>" & "</a>" & "</SPAN><br><br></td></tr></table>"
Result.Movenext
i = i + 1
loop
end if
%>
