RS.Open Visa, Connect
if rs.eof then
response.write "Inga träffar"
else
Do While Not rs.EOF
if pk <> rs("kommun") then
pk = rs("kommun")
response.write "<B>" & pk & "</B><br>"
end if
response.write RS("Lanktxt")&"<br>"
rs.Movenext
Loop
RS.Close: Set rs = nothing
end if
Frågan#1
Hur gör jag för att skriva 'inga träffar' när jag inte har nåt som motsvara sökvärdet i db?
<%
midd = Request.querystring("id")
Land = Request.Form("land")
Set RS = Server.CreateObject("ADODB.Recordset")
Visa = "SELECT * FROM Lan ORDER BY Id"
RS.Open Visa, Connect %>
<b>Välj län:</b><br>
<form method="post">
<input type="hidden" name="midd" value="<% =midd %>">
<select name="land" size="5">
<%
Do While Not rs.EOF
%>
<option value="<% =rs("lan") %>"><% =rs("lan")%></option>
<%
rs.MoveNext
Loop
RS.Close: Set rs = nothing
%></select>
<td width="320" height="15" align="right" valign="top" class="bildtext"></td></tr>
<tr><td width="320" height="*" align="left" valign="top" class="brodtext">
<input type="submit" value="Search" name="Action"></form>
<% If Request.form("midd") <> "" AND Request.form("land") <> "" Then
Set RS = Server.CreateObject("ADODB.Recordset")
Visa = "SELECT * from Lankar WHERE Lan='"&Request.form("land")&"' AND Kategori="&Request.form("midd")&" ORDER BY kommun "
pk = ""
RS.Open Visa, Connect
Do While Not rs.EOF
if pk <> rs("kommun") then
pk = rs("kommun")
response.write "<B>" & pk & "</B><br>"
end if
response.write RS("Lanktxt")&"<br>"
rs.Movenext
Loop
RS.Close: Set rs = nothing
end if
%>
