Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access database connection problem 1

Status
Not open for further replies.

gav12345

Programmer
Dec 4, 2003
198
GB
Hi all,

Bit of a newbie to ASP. I'm running a simple asp page using IIS locally on my PC. All the page does is connect to a simple Access DB via ODBC, then display the contents of a 'Reports' table on the page.

If I've just made a change to the code and saved it, no problems, everything displayed as normal in IE6. If however I refresh the page, the list of reports is no longer displayed.

I have a feeling this is a rather simple problem but just do not know why this is happening.

For what its worth, code as follows:
Code:
<html>
<head>
<title>Untitled</title>
<link rel="stylesheet" 
type="text/css" href="styles.css" />
</head>
<body>
<h3> Test Reports Connection </h3>

<%
On Error Resume Next
Dim con
Dim prm
dim link(10)

Const adCmdStoredProc = 4
Const adInteger = 3

Set con = CreateObject("ADODB.Connection")
con.Open "CentralReporting"

Set cmd = CreateObject("ADODB.Command")
Set cmd.ActiveConnection = con
cmd.CommandText = "Select ReportName from Report"
Set rs = cmd.Execute()

Set cmd2 = CreateObject("ADODB.Command")
Set cmd2.ActiveConnection = con
cmd.CommandText = "Select ReportURL from Report"
Set rs2 = cmd.Execute()
 
dim iCount
dim iCount2
iCount = 0
iCount2 = 0

//Response.Write (rs("ReportName")) & chr(13)

for iCount = 1 to 10 
	//Response.Write (rs("ReportName")) & chr(13)
	link(iCount) = "<a href=" & rs2("ReportURL")& "><h5>" & rs("ReportName") & "</h5></a>"
	rs.movenext
	rs2.movenext
next

for iCount2 = 1 to 10
	response.write (link(iCount2) & "<br>")
next

%>

</body>
</html>

Thanks in advance.
 
I'm just taking a stab at this, but it could be because you're not closing your connection.

<.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top