Tags:
programmering
Hej
Jeg har et problem med min søgmaskinen i asp, det virker nogen gange i IE, men i firefox virker det overhoved ikke!
Kode:
<!--#Include file="../includes/conn.asp" -->
<%
strListFile = Trim(Request.Form("search"))
sqlSearch = "Select varenummer, product, farve, størrelse, pris, status from produkt where"
sqlSearch = sqlSearch & "(varenummer LIKE '%" & strListFile & "%')"
sqlSearch = sqlSearch & " OR (product LIKE '%" & strListFile & "%')"
sqlSearch = sqlSearch & " OR (farve LIKE '%" & strListFile & "%')"
sqlSearch = sqlSearch & " OR (størrelse LIKE '%" & strListFile & "%')"
sqlSearch = sqlSearch & " OR (pris LIKE '%" & strListFile & "%')"
sqlSearch = sqlSearch & " OR (status LIKE '%" & strListFile & "%')"
Set rs = Conn.Execute(sqlSearch)
If not (rs.BOF OR rs.EOF) Then
Response.Write "<p class='godkende'><strong>Varenummer - produkt - farve(r) - størrelse - pris - status</strong><br/><br/>"
Do While Not rs.EOF
Response.Write "<span class='varenummer'>" & rs("varenummer") & "</span> "
Response.Write "<span class='produkt'>" & rs("product") & "</span> "
Response.Write "<span class='farve'>" & rs("farve") & "</span> "
Response.Write "<span class='size'>" & rs("størrelse") & "</span> "
Response.Write "<span class='pris'>" & rs("pris") & "</span> "
Response.Write "<span class='status'>" & rs("status") & "</span><br/></p>"
rs.MoveNext
Loop
Else
Response.Write "Der gav ingen søgning!"
End If
Conn.Close
Set Conn = Nothing
%>
Håber I kan hjælpe mig!
1 svar postet i denne tråd vises herunder
1 indlæg har modtaget i alt 3 karma
Hej,
Hvad er fejlen?
Prøv evt. at indsætte et mellemrum efter where i:
sqlSearch = "Select varenummer, product, farve, størrelse, pris, status from produkt where"
sqlSearch = sqlSearch & "(varenummer LIKE '%" & strListFile & "%')"
Så det bliver til:
sqlSearch = "Select varenummer, product, farve, størrelse, pris, status from produkt where "
sqlSearch = sqlSearch & "(varenummer LIKE '%" & strListFile & "%')"
Mikkel Meyer Andersen (mikl-dk)