Avatar billede intercore Nybegynder
06. marts 2001 - 19:24 Der er 9 kommentarer og
1 løsning

Kun 10 søgeresultater af gangen

Hjælp.
Jeg har et problem jeg vil gerne have lavet paging i dette script. jeg har forsøgt på www.activeserverpage.dk men jeg kan stadig ikke finde ud af det.
Sådan ser scriptet ud og jeg vil blive meget meget glad hvis du vil lave det sådan at der kommer 10 søgeresultater af gangen.

<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strDSN
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"
Response.Write \"<center>\"
Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"
Do While Not rs.EOF
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
rs.MoveNext
Loop
Response.Write \"</FONT></table>\"
Else
Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"
End If
myConn.Close
Set myConn = Nothing
%>
Avatar billede netsrac Praktikant
06. marts 2001 - 19:26 #1
Avatar billede slash Nybegynder
06. marts 2001 - 19:32 #2
det var da det mest uoverskuelige kode jeg længe har set! Hvis du sætter det bedre op er der > mulighed for hjælp!
Avatar billede intercore Nybegynder
06. marts 2001 - 19:33 #3
<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")

Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If

strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")

myConn.Open strDSN
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then

Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"
Response.Write \"<center>\"
Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"
Do While Not rs.EOF
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
rs.MoveNext

Loop
Response.Write \"</FONT></table>\"
Else

Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"
End If

myConn.Close
Set myConn = Nothing
%>
Avatar billede intercore Nybegynder
06. marts 2001 - 19:34 #4
<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")

Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If

strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")

myConn.Open strDSN
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then

Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"

Response.Write \"<center>\"

Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"

Do While Not rs.EOF

Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
rs.MoveNext

Loop
Response.Write \"</FONT></table>\"
Else

Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"

End If

myConn.Close
Set myConn = Nothing
%>
Avatar billede intercore Nybegynder
06. marts 2001 - 19:35 #5
<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")

Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If

strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")

myConn.Open strDSN
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then

Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"


Response.Write \"<center>\"


Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"


Do While Not rs.EOF


Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
rs.MoveNext


Loop
Response.Write \"</FONT></table>\"
Else

Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"

End If

myConn.Close
Set myConn = Nothing
%>




Nu skulle den være der
Avatar billede tpiil Nybegynder
06. marts 2001 - 19:38 #6
<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strDSN
rs.Open strSQL, myConn, 1
intPage = Request(\"side\")
If isNumeric(intPage) = False Or intPage < 1 Then
  intPage = 1
End If
If not (rs.BOF Or rs.EOF) Then
  rs.PageSize = \"10\"
  rs.AbsolutePage = intPage
  intRecCount = rs.PageSize
  intPageCount = rs.PageCount
end if
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"
Response.Write \"<center>\"
Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"
Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
Response.Write \"</FONT></table>\"
Else
Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"
End If
If Clng(intPageCount) > 1 Then %>
<center><font face=\"<%=rs(\"skrifttype\")%>\" size=\"2\"><b>Side
<%
For intNum = 1 To intPageCount
%>
<a href=\"?id=<%=request(\"id\")%>&side=<%=intNum%>\"><%=intNum%></a>
<%
Next
myConn.Close
Set myConn = Nothing
%>
Avatar billede tpiil Nybegynder
06. marts 2001 - 19:39 #7
<%
strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strDSN
rs.Open strSQL, myConn, 1
intPage = Request(\"side\")
If isNumeric(intPage) = False Or intPage < 1 Then
  intPage = 1
End If
If not (rs.BOF Or rs.EOF) Then
  rs.PageSize = \"10\"
  rs.AbsolutePage = intPage
  intRecCount = rs.PageSize
  intPageCount = rs.PageCount
end if
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"
Response.Write \"<center>\"
Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"
Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
Response.Write \"</FONT></table>\"
Else
Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"
End If
If Clng(intPageCount) > 1 Then %>
<center><FONT FACE=\"Verdana, Times New Roman\" SIZE=\"+1\" COLOR=\"black\"><b>Side
<%
For intNum = 1 To intPageCount
%>
<a href=\"?id=<%=request(\"id\")%>&side=<%=intNum%>\"><%=intNum%></a>
<%
Next
myConn.Close
Set myConn = Nothing
%>
Avatar billede tpiil Nybegynder
06. marts 2001 - 19:41 #8
hvis der er fejl i vil jeg godt lige have db\'en til tpiil@netstuff.dk
Avatar billede slash Nybegynder
06. marts 2001 - 19:46 #9
har du forresten overvejet at anvende CSS til formattering af text, tabeller, etc. - eller droppe det indtil koden virker?

Nå, men har brugt copy/paste fra www.active...dk - ved ikke om det virker idet jeg ikke benytter denne pagingløsning til daglig, men derimod arbejder jeg med arrays og pager i dem! PS: target=_new findes ikke i html4.0 specifikationen!

<%
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
  intPage = 1
End If

strKeyword = Trim(Request.Form(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")

Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If

strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")

myConn.Open strDSN
Set rs = myConn.Execute(strSQL)

If Not (rs.BOF Or rs.EOF) Then
  rs.PageSize = 10
  rs.AbsolutePage = intPage
  intRecCount = rs.PageSize
  intPageCount = rs.PageCount
  Response.Write \"<p><b>Side \" & intPage & \" af \" & intPageCount & \"</b></p>\"
  Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_blank>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_blank>Bes&oslash;g</a><BR><HR></td></tr>\"
 


  intRecCount = intRecCount - 1
  rs.MoveNext
  Loop
End If
rs.Close
Set rs = Nothing

Response.Write \"<p>Gå til side \"
For intNum = 1 To intPageCount
  Response.Write \"<a href=default.asp?page=\" & intNum & \">\" & intNum & \"</a> \"
Next

Response.Write \"<p>\"
If Clng(intPage) > 1 Then
  Response.Write \"<a href=default.asp?page=\" & intPage - 1 & \">&lt;&lt;</a>\"
Else
  Response.Write \"&lt;&lt;\"
End If

Response.Write \"&nbsp;\"

If Clng(intPage) < Clng(intPageCount) Then
  Response.Write \"<a href=default.asp?page=\" & intPage + 1 & \">&gt;&gt;</a> \"
Else
  Response.Write \"&gt;&gt;\"
End If
%>

Avatar billede tpiil Nybegynder
06. marts 2001 - 20:21 #10
koden blev sådan her, jeg hjalp ham over mail:
<%
strKeyword = Trim(Request(\"Keyword\"))
If Len(strKeyword) = 0 Then
Response.Clear
Response.Redirect(\"search.asp\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT LinkID, LinkName, LinkDesc, LinkURL, LinkHits, LinkID, LinkAdded, LinkWord, LinkPlus FROM links WHERE\"
strSQL = strSQL & \" (LinkName LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (LinkWord LIKE \'%\" & strKeyword & \"%\')\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"database.mdb\")
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strDSN
rs.Open strSQL, myConn, 1
intPage = Request(\"side\")
If isNumeric(intPage) = False Or intPage < 1 Then
  intPage = 1
End If
If not (rs.BOF Or rs.EOF) Then
  rs.PageSize = \"10\"
  rs.AbsolutePage = intPage
  intRecCount = rs.PageSize
  intPageCount = rs.PageCount
end if
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\"><CENTER><A HREF=\"\"default.asp\"\" TARGET=\"\"_top\"\">Hjem</A> : S&oslash;geresultat fra S&oslash;g</CENTER></FONT></p>\"
Response.Write \"<center>\"
Response.Write \"<table border=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"80%\"\" cellpadding=\"\"3\"\" bgcolor=\"\"#000000\"\">\"
Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td width=100% bgcolor=#006bb6><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"2\"\" color=\"\"black\"\">\" & rs(\"LinkPlus\") & \"<a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>\"& rs(\"LinkName\") &\"</A> - \" & rs(\"LinkDesc\")&\"<BR></FONT><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"1\"\" color=\"\"black\"\">Bes&oslash;g fra S&oslash;g :</FONT> <FONT face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" Color=\"\"black\"\">\" & rs(\"LinkHits\") & \"</font><BR><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">Adresse : </font><font face=\"\"Verdana, Times New Roman\"\" Size=\"\"1\"\" color=\"\"black\"\">\" & rs(\"LinkURL\") &\" - <a href=redirect.asp?linkid=\"& rs(\"LinkID\")&\" TARGET=_new>Bes&oslash;g</a><BR><HR></td></tr>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
Response.Write \"</FONT></table>\"
Else
Response.Write \"<center><p><FONT FACE=\"\"Verdana, Times New Roman\"\" SIZE=\"\"+1\"\" COLOR=\"\"black\"\"><A HREF=default.asp>Websøg</a> fandt intet der svarede til dit søgeord<BR><BR>Tilbage til start? <A HREF=default.asp>Klik her</A></p></center>\"
End If
If Clng(intPageCount) > 1 Then %>
<center><FONT FACE=\"Verdana, Times New Roman\" SIZE=\"+1\" COLOR=\"black\"><b>Side
<% end if %>
<%
For intNum = 1 To intPageCount
%>

<a href=\"?Keyword=<%=request(\"Keyword\")%>&side=<%=intNum%>\"><%=intNum%></a>

<%
Next
myConn.Close
Set myConn = Nothing
%>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester