Hej
Jeg har brugt den kode her under til at søge i access men er nu begyndt
med mysql men jeg kan ikke få det til at virke der kommer en fejl med:
ADODB.Recordset error '800a0cb3'
Current Recordset does not support bookmarks. This may be a limitation
of the provider or of the selected cursortype.
Og jeg har søgt på google men jeg kan ikke lige finde nogen eks. på
hvordan man laver en dynamisk sql streng og paging med mysql kan _i_
hjælpe.?
<%
dim rstemp, sqltemp, intPage, intNum
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=*******"
rstemp = Request.QueryString("rstemp")
'---------------det her er den gamle sogefuktion som
virker-------------------
' Henter værdien fra soeg.htm
rstemp = LTrim(Request("rstemp"))
rstemp = Replace(rstemp,"'","''")
Search = Split(rstemp," ")
' Opbygger en dynamisk SQL streng
For antalord = 0 To UBound(Search)
'For antalord = LBound(Search)+1 To UBound(Search)
sqltemp = "SELECT LinkID, Sitename, Keyword, Info, Url, MainGrup,
Katogori, Levelone, Count, LastDate FROM link WHERE"
sqltemp = sqltemp & " (Sitename LIKE '%" & Search(antalord) & "') AND
(([link]![godkent]=True))"
sqltemp = sqltemp & " OR (Keyword LIKE '%" & Search(antalord) & "%') AND
(([link]![godkent]=True))"
sqltemp = sqltemp & " OR (Info LIKE '" & Search(antalord) & "') AND
(([link]![godkent]=True))"
sqltemp = sqltemp & " OR (Url LIKE '" & Search(antalord) & "') AND
(([link]![godkent]=True))"
Next
'---------------------------slut paa funktion------------------
intPage = Request("page")
If isNumeric(intPage) = False Or intpage < 1 Then
intPage = 1
End if
%>
<P><B>Du søgte efter '<% = (Request("rstemp"))%>'</B></P>
<%
set rstemp=Server.CreateObject("ADODB.Recordset")
rstemp.Open sqltemp, db, adOpenKeySet, adLockReadOnly
If Not (rstemp.BOF Or rstemp.EOF) Then
rstemp.PageSize = 8
rstemp.AbsolutePage = intPage
intRecCount = rstemp.PageSize
intPageCount = rstemp.PageCount
%>
<%
If not (rstemp.BOF Or rstemp.EOF Or (Request("rstemp")) ="")Then
Response.Write "<P>Søgeresultat Side " & intPage & " af " & intPageCount
& "</P>"
do while not rstemp.EOF And intRecCount > 0
Response.Write "<P><B>Information om:</B> "
Response.Write "<A HREF=" & Chr(34)
&"info.asp?LinkID="&(rstemp("LinkID")) & Chr(34) &">" &
rstemp("Sitename")&"</A>"
Response.Write "<BR><B>Gruppe:</B> <A HREF=" & Chr(34) &
"hovedgruppe.asp?MainGrup="& server.URLencode(rstemp("MainGrup"))&""&
Chr(34) &""
Response.Write ">"& (rstemp("MainGrup"))&"</A> "
Response.Write "<BR><B>Kategori:</B> <A HREF=" & Chr(34) &
"katogori.asp?MainGrup="&
server.URLencode(rstemp("MainGrup"))&"&Katogori="&
server.URLencode(rstemp("Katogori"))&""& Chr(34) &""
Response.Write ">"&(rstemp("Katogori"))&"</A>"
Response.Write "<BR><B>URL:</B> "
Response.Write "<A HREF=" & Chr(34) &"redict.asp?LinkID="&
(rstemp("LinkID")) & Chr(34) &">"
Response.Write rstemp("Url")
Response.Write "</A>"
Response.Write "<BR>"
Response.Write "<B>index Dato:</B> "
Response.Write rstemp("LastDate")
Response.Write "<BR></P>"
intRecCount = intRecCount - 1
rstemp.movenext
loop
Response.Write "<P>Gå til side "
For intNum = 1 To intPageCount
Response.Write "<A HREF=" & Chr(34) &"search.asp?rstemp="&
server.URLencode(Request("rstemp")) &"&page=" & intNum & Chr(34)
&">" & intNum & "</A> "
Next
Response.Write "<P>"
If Clng(intPage) > 1 Then
Response.Write "<A HREF=" & Chr(34) &"search.asp?rstemp="&
server.URLencode(Request("rstemp")) &"&page=" & intPage - 1 &
Chr(34) &"><<</A>"
Else
Response.Write "<<"
End If
Response.Write " "
If Clng(intPage) < Clng(intPageCount) Then
Response.Write "<A HREF=" & Chr(34) &"search.asp?rstemp="&
server.URLencode(Request("rstemp")) &"&page=" & intPage + 1 &
Chr(34) &">>></A> "
Else
Response.Write ">>"
End IF
rstemp.close
set rstemp=nothing
End If
Else
' Hvis der ikke er fundet poster på søgningen
Response.Write "<p>Der blev ikke fundet noget på din søgning</p>"
rstemp.close
set rstemp=nothing
End If
db.Close
Set db = Nothing
%>
|