Der er noget galt den skriver:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to
open registry key 'Temporary (volatile) Jet DSN for process 0x700
Thread 0x824 DBC 0x145a2a3c Jet'.
/login/admin.asp, line 38
Min kode er:
<html>
<head>
<title>admin</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<%
If Session("admin_password") <> "" then
mode = Request.QueryString("mode")
if mode = "godkend_bruger" then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
Set rs = Conn.Execute("UPDATE bruger SET godkendt = 'ja' WHERE id
= " & request("id"))
Conn.Close
Set Conn = Nothing
response.redirect("admin.asp")
end if
if mode = "slet_bruger" then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
Set rs = Conn.Execute("DELETE FROM bruger WHERE id = " &
request("id"))
Conn.Close
Set Conn = Nothing
response.redirect("admin.asp")
end if
if mode = "" then
strDSN = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM bruger WHERE godkendt='nej' ORDER BY
brugernavn"
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
%>
<b>Bruger der gerne Vil Godkendes!</b><p>
<table>
<tr><td bgcolor="#C0C0C0">brugernavn</td><td
bgcolor="#C0C0C0">password</td><td bgcolor="#C0C0C0">rigtigt
navn</td><td bgcolor="#C0C0C0">email</td><td
bgcolor="#C0C0C0">Slet</td><td
bgcolor="#C0C0C0">Godkend</td></tr>
<% Do While Not rs.EOF %>
<tr><td><%=rs("brugernavn")%></td><td><%=rs("brugerkode")%></td><
td><%=rs("brugerrigtignavn")%></td><td><%=rs("brugeremail")%></td
><td><a
href="admin.asp?mode=slet_bruger&id=<%=rs("id")%>">Slet</a></td><
td><a
href="admin.asp?mode=godkend_bruger&id=<%=rs("id")%>">Godkend</a>
</td></tr>
<% rs.MoveNext
Loop %>
<tr><td colspan="6"><hr></td></tr>
<% else %>
<tr><td colspan="6">Der er ikke nogen nye bruger, der vil
godkendes :(</td></tr>
<% End If
rs.Close
Set rs = Nothing %>
</table>
<%
strDSN = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "select * from nyheder"
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
%>
<p><b>Alle nyheder, med de nyeste først!</b><p>
<table>
<tr><td bgcolor="#C0C0C0">overskrift</td><td
bgcolor="#C0C0C0">dato</td><td bgcolor="#C0C0C0">slet</td></tr>
<% Do While Not rs.EOF %>
<tr><td><a href="nyheder.asp?id=<%=rs("id")%>"
target="_blank"></a>
<%=rs("overskrift")%></td><td><%=rs("dato")%></td><td><a
href="admin.asp?mode=slet_nyhed&id=<%=rs("id")%>">Slet</a></td><t
r>
<% rs.MoveNext
Loop %>
<tr><td colspan="3"><hr></td></tr>
<% else %>
<p>Der er ikke nogen Nyheder :(
<% End If %>
</table><p><a href="admin.asp?mode=ny_nyhed">Lav ny Nyhed</a>
<% rs.Close
Set rs = Nothing %>
<% end if %>
<% if mode = "ny_nyhed" then %>
<%
Response.Buffer = True
Set conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
if Request("overskrift") <> "" AND Request("tekst") <> "" then
overskrift = Request.Form("overskrift")
tekst = Server.HTMLEncode(Request.Form("tekst"))
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from nyheder"
rs.open sql, conn, 1, 3
Function DanskDatoTid(dato)
arrDag = ",mandag,tirsdag,onsdag,torsdag,fredag,lørdag,søndag"
arrDag = Split(arrDag,",")
arrMaaned = ",januar,februar,marts,april,maj,juni,juli,august,"
arrMaaned = arrMaaned & "september,oktober,november,december"
arrMaaned = Split(arrMaaned,",")
DanskDatoTid = arrDag(Weekday(dato,VbMonday)) & " d. " &
Day(dato) & ". "
DanskDatoTid = DanskDatoTid & arrMaaned(Month(dato)) & " " &
Year(dato)
DanskDatoTid = DanskDatoTid & " kl. " & FormatDateTime(dato,
vbShortTime)
End Function
rs.addnew
rs("overskrift") = Server.HTMLEncode(Request("overskrift"))
rs("tekst") = Server.HTMLEncode(Request("tekst"))
rs("Dato") = DanskDatoTid(Now)
rs.update
rs.close
set rs = Nothing
response.redirect("admin.asp")
end if
%>
<form method="post" action="admin.asp?mode=ny_nyhed">
<table>
<tr><td>Overskrift:</td><td><input type="text" name="overskrift"
value="<%=Request("overskrift")%>"></td></tr>
<tr><td>Indhold:</td><td><textarea name="tekst" cols="20"
rows="5"><%=Request("tekst")%></textarea></td></tr>
<tr><td colspan="2"><p><input type="submit"
value="Tilføj"></td></tr>
</table>
</form>
<% end if %>
<% if mode = "slet_nyhed" then %>
<% Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("db.mdb")
Set rs = Conn.Execute("DELETE FROM nyheder WHERE id = " &
request("id"))
Conn.Close
Set Conn = Nothing
Response.redirect("admin.asp")
End If
Else
%>
<h1>Administrator Login</h1>
<%
If not Request.ServerVariables("REQUEST_METHOD") = "POST" then
%>
<form method="post" action="admin.asp">
<table>
<tr>
<td>Dit Password</td>
<td><input type="password" name="password">
</tr>
<tr>
<td colspan="2"><input type="submit" value="Login"></td>
</tr>
</table>
</form>
<%
Else
Strpassword = "1"
If Request.form("password") = Strpassword then
Session("admin_password") = Request.form("password")
Response.Redirect "admin.asp"
Else
Response.Write "<font color=red>Ugyldigt Password!</font>"
End if
End if
End If
%>
</html>
Værd sød at hjælpe mig!!
MvH
Andreas
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP ???
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials