Offline virker database, men ikke online - Mystisk?
Hej AlleJeg har et underligt problem, synes jeg selv. På www.game-research.com/searchv4.htm virker checkboxene ikke enten viser de ingen resultater eller også viser de alle. Offline i min personal webserver virker det fint. Det er virkelig underligt. Nogle ideer. jeg har indsat scriptet nedenfor.
<%
\' Henter værdien fra soeg.htm
strKeyword = Trim(Request.Form(\"Keyword\"))
strsprog= Request.Form(\"sprog\")
strwriting= Request.Form(\"writing\")
strrelevance = Request.Form(\"relevance\")
strbusiness= Request.Form(\"business\")
strwireless= Request.Form(\"wireless\")
strhistory= Request.Form(\"history\")
strgender= Request.Form(\"gender\")
stronline= Request.Form(\"online\")
streducation = Request.Form(\"education\")
strhealth = Request.Form(\"health\")
strstatistics= Request.Form(\"statistics\")
strdesign = Request.Form(\"design\")
strculture = Request.Form(\"culture\")
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
\' Opbygger en dynamisk SQL streng
strSQL = \"SELECT author, title, pa, publisher, freetext, url FROM users WHERE\"
strSQL = strSQL & \" ((author LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (title LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (publisher LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (freetext LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (url LIKE \'%\" & strKeyword & \"%\'))\"
\' Checker om der er skrevet i felterne
if Len(strsprog) > 0 then
strSQL = strSQL & \" AND (sprog = \'\" & strsprog & \"\')\"
else strSQL =strSQL
end if
if Len(strwriting) > 0 then
strSQL = strSQL & \" AND (writing = \'\" & strwriting & \"\')\"
end if
if Len(strrelevance) > 0 then
strSQL = strSQL & \" AND (relevance = \'\" & strrelevance & \"\')\"
end if
if Len(strbusiness) > 0 then
strSQL = strSQL & \" AND(business = 1)\"
end If
if Len(strbusiness) > 0 then
strSQL = strSQL & \" AND(business = 1)\"
end If
if Len(strwireless) > 0 then
strSQL = strSQL & \" AND(wireless = 1)\"
end If
if Len(strhistory) > 0 then
strSQL = strSQL & \" AND(history = 1)\"
end If
if Len(streducation) > 0 then
strSQL = strSQL & \" AND(education = 1)\"
end If
if Len(strgender) > 0 then
strSQL = strSQL & \" AND(gender = 1)\"
end If
if Len(stronline) > 0 then
strSQL = strSQL & \" AND(online = 1)\"
end If
if Len(strstatistics) > 0 then
strSQL = strSQL & \" AND(statistics = 1)\"
end If
if Len(strhealth) > 0 then
strSQL = strSQL & \" AND(health = 1)\"
end If
if Len(strdesign) > 0 then
strSQL = strSQL & \" AND(design = 1)\"
end If
if Len(strculture) > 0 then
strSQL = strSQL & \" AND(culture = 1)\"
end If
\' Skaber DSNLess forbindelse til DBen
strConnect = \"Data Source=d:\\home\\gameresearchcom\\db\\game-research-ref.mdb;Provider=Microsoft.Jet.OLEDB.4.0;\"
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open strConnect
\' Skaber et recordset udfra SQL strengen
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
\' Hvis der er fundet poster på søgningen
Response.Write \"<table width=100% cellpadding=3 class=tabeltekst>\"
Response.Write \"<tr bgcolor=#CCCCCC><th>Author</th><th>Title</th><th>Year</th><th>Publisher</th><th>Description</th><th>URL</th></tr>\"
Do While Not rs.EOF
Response.Write \"<tr><td valign=top>\" & rs(\"author\") & \"</td>\"
Response.Write \"<td valign=top>\" & rs(\"title\") & \"</td>\"
Response.Write \"<td valign=top>\" & rs(\"pa\") & \"</td>\"
Response.Write \"<td valign=top>\" & rs(\"publisher\") & \"</td>\"
Response.Write \"<td valign=top>\" & rs(\"freetext\") & \"</td>\"
Response.Write \"<td valign=top><a href=\" & rs(\"url\") & \">click</a></td></tr>\"
rs.MoveNext
Loop
Response.Write \"</table>\"
Else
\' Hvis der ikke er fundet poster på søgningen
Response.Write \"<p>Der er ikke fundet noget på denne søgning</p>\"
End If
\' Rydder op efter os
myConn.Close
Set myConn = Nothing
%>
