Avatar billede snebolle Nybegynder
30. september 2002 - 13:19 Der er 4 kommentarer og
1 løsning

Siden virker med den kommer med en fejl

Hej,
Jeg har prøvet at lave denne kode i asp og den virker også men den kommer med en Server 500-fejl. Er det ikke fordi jeg bruger samme funktion 4 gange eller hvad? Hvordan kan jeg løse problemet?

<%   
Set myConn = Server.CreateObject("ADODB.connection")     
myConn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("forum.mdb")) ' Opret forbindelse til databasen

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <TITLE>Test</TITLE>
<LINK REL="STYLESHEET" HREF="../images/tekst.css" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000">
<BR><BR><BR><TABLE WIDTH="500" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
    <TD BGCOLOR="#FFFFFF" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1">&nbsp;&nbsp;<B>3d programmer</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Indlæg</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Seneste</B></TD>
</TR>
<% 
  if Request.QueryString("id") = "" then ' Hvis der ikke er specificeret en "id", vises liste over alle forum

    Set DBoutPut = myConn.Execute("Select * From forums WHERE Description = '3D-programmer'")
    While not DBoutPut.EOF 
%>
<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21-09-2002 19:24</TD>
</TR>
<%
    DBoutPut.Movenext
    Wend
%> 
</TABLE><% end if %><BR><BR>
<TABLE WIDTH="500" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
    <TD BGCOLOR="#FFFFFF" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1">&nbsp;&nbsp;<B>2D programmer</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Indlæg</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Seneste</B></TD>
</TR>
<% 
  if Request.QueryString("id") = "" then ' Hvis der ikke er specificeret en "id", vises liste over alle forum 
    Set DBoutPut = myConn.Execute("Select * From forums WHERE Description = '2D-programmer'")
    While not DBoutPut.EOF 
%>
<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21-09-2002 19:24</TD>
</TR>
<%
    DBoutPut.Movenext
    Wend
%> 
</TABLE><% end if %><BR><BR>
<TABLE WIDTH="500" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
    <TD BGCOLOR="#FFFFFF" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1">&nbsp;&nbsp;<B>Vurdering</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Indlæg</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Seneste</B></TD>
</TR>
<% 
  if Request.QueryString("id") = "" then ' Hvis der ikke er specificeret en "id", vises liste over alle forum 
    Set DBoutPut = myConn.Execute("Select * From forums WHERE Description = 'Vurdering'")
    While not DBoutPut.EOF 
%>
<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21-09-2002 19:24</TD>
</TR>
<%
    DBoutPut.Movenext
    Wend
%> 
</TABLE><% end if %><BR><BR>
<TABLE WIDTH="500" BORDER="0" CELLSPACING="1" CELLPADDING="1">
<TR>
    <TD BGCOLOR="#FFFFFF" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1">&nbsp;&nbsp;<B>ekspert.dk</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Indlæg</B></TD>
    <TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Seneste</B></TD>
</TR>
<% 
  if Request.QueryString("id") = "" then ' Hvis der ikke er specificeret en "id", vises liste over alle forum 
    Set DBoutPut = myConn.Execute("Select * From forums WHERE Description = 'ekspert.dk'")
    While not DBoutPut.EOF 
%>
<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21-09-2002 19:24</TD>
</TR>
<%
    DBoutPut.Movenext
    Wend
%> 
</TABLE><% end if %>


</BODY>
</HTML>
Avatar billede coltau Juniormester
30. september 2002 - 22:41 #1
Koden fejler intet - jeg har testet det som det er. Så det eneste sted jeg kan tro at der er fejl er i denne linie:

myConn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("forum.mdb"))

Du skal angive den rigtige sti til databasen:

Server.MapPath("forum.mdb"))

Jeg tror at du skal kontrollere stien til databasen.
Avatar billede snebolle Nybegynder
30. september 2002 - 22:58 #2
Jep,
Grunden til jeg har lavet det på den måde er at jeg skal have lavet denne kode om http://www.eksperten.dk/spm/262468
Men nu skal jeg have overført koderne som gør at den skriv indlæg og sidste dato. Håber virkelig du kunne hjælpe med det fordi jeg kan bare ikke komme videre..

Selvfølgelig kun hvis du har tid/løst.
Avatar billede coltau Juniormester
30. september 2002 - 23:33 #3
Så skal du vel først have ovenstående kode til at virke - så tror jeg at resten er rimelig let.

Hvis ikke ovenstående kode virker kan det være fordi:

1. Databasen kan ikke findes.
2. Tabellen findes ikke i databasen.
3. felterne ID, Description, Forums findes ikke i databasen.
Avatar billede snebolle Nybegynder
30. september 2002 - 23:46 #4
Jep jeg har fået ovenstående kode til at virke. Derfor du også har fået dine point.
Avatar billede coltau Juniormester
01. oktober 2002 - 00:09 #5
Så er resten jo en leg . :-)

Så skal du bare ændre disse linier:

<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21-09-2002 19:24</TD>
</TR>

således at de udskriver dato og indlæg:

Her er datoen lagt ind.

<TR>
    <TD STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("forum")%></TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px">21</TD>
    <TD ALIGN="center" STYLE="border-bottom: thin dotted #E2E2E2; border-bottom-width: 1px"><%=DBoutPut("dato")%></TD>
</TR>
Avatar billede Ny bruger Nybegynder

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.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester