<% Sub pri_del %> <%'### Choose what posts to delete (aka list all) %> <% Set conntemp = server.createobject("adodb.connection") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; " DSNtemp=dsntemp & "DBQ=" & server.mappath("count.mdb") conntemp.Open DSNtemp strsql = "SELECT * FROM cervus ORDER BY id" set rs = conntemp.Execute(strsql) %>
<% bg = 1 Do while not rs.eof If bg = "1" Then bgcolor = "#EEEEEE" Elseif bg = "2" Then bgcolor = "#DDDDDD" End If %> <% rs.MoveNext If bg = "1" Then bg = "2" Elseif bg = "2" Then bg = "1" End If loop %>
" value="<%=rs("id")%>">  

Uppdatera Kronhjorts avskjutningen

 Leif !
Ändra aktuell avskjutning, glöm inte summan, klicka sedan på uppdatera.


<% If rs("hj10") > "" Then %> <%=rs("hj10")%>
<% End If %> <% If rs("hi10") > "" Then %> <%=rs("hi10")%>
<% End If %> <% If rs("ka10") > "" Then %> <%=rs("ka10")%>
<% End If %> <% If rs("sum10") > "" Then %> <%=rs("sum10")%>
<% End If %> <% If rs("hj11") > "" Then %> <%=rs("hj11")%>
<% End If %> <% If rs("hi11") > "" Then %> <%=rs("hi11")%>
<% End If %> <% If rs("ka11") > "" Then %> <%=rs("ka11")%>
<% End If %> <% If rs("sum11") > "" Then %> <%=rs("sum11")%>
<% End If %> <% If rs("hj12") > "" Then %> <%=rs("hj12")%>
<% End If %> <% If rs("hi12") > "" Then %> <%=rs("hi12")%>
<% End If %> <% If rs("ka12") > "" Then %> <%=rs("ka12")%>
<% End If %> <% If rs("sum12") > "" Then %> <%=rs("sum12")%>
<% End If %>

">Ändra post 
<% rs.close conntemp.Close set rs = nothing set conntemp = nothing %> <% End Sub %> <% Sub conf_del %> <%'### Confirm deletetion %>

<% itemcount = "0" For Each k In request.form If not k = "delsub" Then If Not K = "postnr" Then Itemcount = Itemcount + 1 Response.write "" & VbCrLf End If End If Next %>
Vill du verkligen radera alla <%=Itemcount%> poster?
  
<% End Sub %> <% '### Delete posts from database Sub real_del Set conntemp = server.createobject("adodb.connection") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; " DSNtemp=dsntemp & "DBQ=" & server.mappath("count.mdb") conntemp.Open DSNtemp 'View posts marked for deletion: strsql = "SELECT * FROM cervus WHERE id=" itemCount = "0" For each k in Request.Form If not k = "delsub" Then itemCount = itemCount + 1 If itemCount = "1" Then strsql = strsql & k Else strsql = strsql & " OR id=" & k End If End If Next strsql = strsql & " ORDER BY id" Response.Write "Dessa poster har tagits bort:

" & VbCrLf set rs = conntemp.Execute(strsql) Do until rs.eof Response.write _ %> ID: <%=rs("id")%>

<% rs.MoveNext Loop 'This part is looping through every id thats been posted here, and deletes marked posts in dbase For Each Del In Request.Form If Not Del = "delsub" Then DelStrSql = "DELETE FROM cervus WHERE id=" & Del Conntemp.Execute(DelStrSql) End If Next Conntemp.Close set rs = nothing set conntemp = nothing End Sub %> <% Sub changePost %> <%'### This sub allows input of new data - Next thing to happens is form posting changes to sub updatePost%> Ändra post nr <%=Request.Querystring("postnr")%>:

<% Set conntemp = server.createobject("adodb.connection") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; " DSNtemp=dsntemp & "DBQ=" & server.mappath("count.mdb") conntemp.Open DSNtemp strsql = "SELECT * FROM cervus WHERE id =" & Request.Querystring("id") & "" set rs = conntemp.Execute(strsql) Do while not rs.eof Response.Write _ %>
">           2010
Hjort:
" size="20">
Hind:
" size="20">
Kalv:
" size="20">
Summa:
" size="20">

">           2011
Hjort:
" size="20">
Hind:
" size="20">
Kalv:
" size="20">
Summa:
" size="20">

">           2012
Hjort:
" size="20">
Hind:
" size="20">
Kalv:
" size="20">
Summa:
" size="20">

<% rs.MoveNext loop rs.close conntemp.Close set rs = nothing set conntemp = nothing %> <% End Sub %> <% Sub updatePost %> <%'### This sub is for updating changes made in changePost %> <% set conn = server.createobject("adodb.connection") DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; " DSNtemp=dsntemp & "DBQ=" & server.mappath("count.mdb") conn.Open DSNtemp sqlstr = "UPDATE cervus SET" sqlstr = sqlstr & "hj10='" & Request.Form("hj10") & "', " sqlstr = sqlstr & "hi10='" & Request.Form("hi10") & "', " sqlstr = sqlstr & "ka10='" & Request.Form("ka10") & "', " sqlstr = sqlstr & "sum10='" & Request.Form("sum10") & "', " sqlstr = sqlstr & "hj11='" & Request.Form("hj11") & "', " sqlstr = sqlstr & "hi11='" & Request.Form("hi11") & "', " sqlstr = sqlstr & "ka11='" & Request.Form("ka11") & "', " sqlstr = sqlstr & "sum11='" & Request.Form("sum11") & "', " sqlstr = sqlstr & "hj12='" & Request.Form("hj12") & "', " sqlstr = sqlstr & "hi12='" & Request.Form("hi12") & "', " sqlstr = sqlstr & "ka12='" & Request.Form("ka12") & "', " sqlstr = sqlstr & "sum12='" & Request.Form("sum12") & "', " sqlstr = sqlstr & " WHERE id= " & Request.Form("id") conn.execute(sqlstr) Conn.Close Set Conn = Nothing Set sqlstr = Nothing Response.Redirect "cervus.asp" %> <% End Sub %> <% delsub = Request.Form("delsub") If Request.Querystring("changePost") <> "" Then delsub = Request.Querystring("changePost") End If Select Case delsub Case "" : pri_del Case "conf_del" : conf_del Case "real_del" : real_del Case "changePost" : changePost Case "updatePost" : updatePost End Select %>