10. maj 2004 - 13:55Der er
10 kommentarer og 1 løsning
lille problem med Do While
jeg er ved at lave en lille søge funktion som oprendeligt var lavet til ms acces database, men nu har jeg lavet den om til en ms_sql database, før brugte jeg denne sætning: Do While Not RS.EOF
der er et par stykker i nogle if sætninger men her er en af dem:
SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
If R1 = "e" and C5 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e'"
elseIf R1 = "e" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "e" and C1 = "" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='e' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C5 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p'"
elseIf R1 = "p" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "p" and C1 = "" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='p' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C5 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w'"
elseIf R1 = "w" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "w" and C1 = "" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND filetype='w' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C5 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%'"
elseIf R1 = "v" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "YES" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'YES' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "YES" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'YES' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "YES" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'YES' and examples = 'NO' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "" and C3 = "YES" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'NO' and examples = 'YES' and templates = 'YES' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "" and C3 = "" and C4 = "" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'NO' ORDER BY filename"
elseIf R1 = "v" and C1 = "" and C2 = "" and C3 = "" and C4 = "YES" Then SQL = "SELECT * FROM documents WHERE filename like '%" & searchfor & "%' AND training = 'NO' and presentations = 'NO' and examples = 'NO' and templates = 'YES' ORDER BY filename"
end if
Set RS = Conn.Execute(SQL) count = 0 if RS.eof then response.write "<b>0 resultater</b>" end if
Do While Not RS.EOF count = count + 1 %> <%=count%>. <a title="<%=RS("filename")%>" href="\\fp02-f01\CF01-GRP\Projekter\DPP\PRG\Attachements\Active attachements\<%=RS("path")%><%=RS("filename")%>"> <%=RS("filename")%></a><br><br><% RS.MoveNext Loop
RS.close set RS = nothing Conn.close set Conn = nothing <br> <hr>
<% if count <> 0 then %> Der var i alt <%=count%> resultater der matchede din søgning.
hehe fandt selv udaf det men takker... jeg må lære at kikke mig ordenligt for inden jeg spørger. man bliver bare træt at at kikke på kode fra 7 - 17 hværdag
Synes godt om
Ny brugerNybegynder
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.