Underlig fejl gentager sig!
Hej !Back...nu har jeg 2 sider. view_select_bg.asp hvor man ser et udtræk fra databasen. Herefter kan man så klikke på et at linkene og udfra ID_no bliver man så sendt over på view_selected.asp. Mit problem er at det virker nogle gange og andre gange melder den fejl i den her linie på view_selected : adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/krcDB.mdb")
Får jeg ikke lukket rigtigt eller hvad sker der ?
view_select_bg.asp :
<% Session.LCID=1030 %>
<html>
<head>
<title>View_select_bg</title>
<link rel="stylesheet" type="text/css" href="fiskestil.css">
</head>
<body bgcolor="#F9F9F9" text="black">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%">
<p align="center">
<font face="Verdana" size="2">
<strong>
Fangstrapporter </strong></font></p>
</td>
</tr>
<tr>
<td width="100%">
<hr width="530px">
</td>
</tr>
</table>
</center>
</div>
<br>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/krcDB.mdb")
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT testtabel.* FROM testtabel order by dato desc;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
Rad = 1
'Loop through the recordset
Do While not rsGuestbook.EOF
%>
<div align="center">
<table border="0" cellpadding="0" cellspacing="1" width="530px">
<%
If (Rad mod 2) = 1 Then
BGFarge = "#dfdfdf"
Else
BGFarge = "#eeeeee"
End If
Rad = Rad + 1
%>
<tr>
<td width="15%" bgcolor=<%=BGFarge%>>
<%
Response.write "<FONT size=1 face=verdana>" & rsguestbook("dato") & "</FONT>"
%>
</td>
<td width="65%" bgcolor=<%=BGFarge%>>
<%
Response.Write ("<a href=""view_selected.asp?ID=" & rsGuestbook("ID_no") & """>")
Response.Write (rsGuestbook("fangst"))
Response.Write ("</a>")
%>
</td>
<td width="20%" bgcolor=<%=BGFarge%>> <%
Response.write "<FONT size=1 face=verdana>" & rsguestbook("forfatter") & "</FONT>"
%>
</td>
</tr>
</table>
</div>
<%
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html>
view_selected.asp :
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/krcDB.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT testtabel.* FROM testtabel WHERE ID_no=" & lngRecordNo
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
%>
<html>
<head>
<title>View_selected</title>
<link rel="stylesheet" type="text/css" href="fiskestil.css">
</head>
<body bgcolor="#E6E6E6" text="black">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%">
<p align="right">
<font face="Verdana" size="2">
<strong>
<% = rsGuestbook("forfatter") %>'s fangstrapport
</strong>
</font>
</p>
</td>
</tr>
<tr>
<td width="100%">
<hr width="530px">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%">
<p align="left">
<font face="Verdana" size="1">
<strong>
<a href="view_select_bg.asp">
Tilbage
</a>
</strong>
</font>
</p>
</td>
</tr>
</table>
</center>
</div>
<br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="table1">
<tr>
<td><% = rsGuestbook("Forfatter") %></td>
</tr>
<tr>
<td><% = rsGuestbook("fangstmnd") %></td>
</tr>
<tr>
<td><% = rsGuestbook("url") %> </td>
</tr>
<tr>
<td><% = rsGuestbook("tid") %> </td>
</tr>
<tr>
<td><% = rsGuestbook("dato") %> </td>
</tr>
<tr>
<td><% = rsGuestbook("fangst") %> </td>
</tr>
<tr>
<td><% = rsGuestbook("vaegt") %></td>
</tr>
<tr>
<td><% = rsGuestbook("sted") %></td>
</tr>
<tr>
<td><% = rsGuestbook("metode") %></td>
</tr>
<tr>
<td><% = rsGuestbook("beretning") %></td>
</tr>
</table>
<br>
<center>
<img src="images/530px.gif" align="textTop" width="530" height="1"></td>
</center>
</font>
</body>
</html>
</font><%
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
