I'm an utter asp novice, trying to read information from an access 2007 database in the db folder which sits above the root folder for my site, hosted by webwiz. I'm trying to use this to produce an RSS feed
I've tried amalgamating a script from one of the tutorials here and a script that I know works with something similar on another site and I'm getting an ADODB.Recordset error '800a0e7d' saying "The connection cannot be used to perform this operation. It is either closed or invalid in this context."
I'm obviously in a complete mess with this and don't even seem to be opening and reading the database. The relevant lines from the script are below. Can anyone give me some pointers please. This would be very much appreciated. Thanks
Les
........
<%
Dim adoCon 'holds the database connection object
Dim rsVac1 'holds the recordset for the records in the database
Dim strSQL 'holds the SQL query to query the database
response.Buffer = true
response.ContentType = "text/xml"
%>
<rss version="2.0">
<channel>
<title>Title</title>
<link>Link</link>
<description>Description</description>
<language>en-gb</language>
<image>
<title>Image title</title>
<url>image link</url>
<link>Feed link</link>
</image>
<%
'function to clean up any 'wrong' characters
function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
ApplyXMLFormatting = strInput
end Function
' Setup a RecordSet to store the results from our SQL Query.
Set adoCon = Server.CreateObject("ADODB.Recordset")
'set an active connection to the connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.jet.OLEDB.4.0; Data Source=../db/vacs.accdb"
'create an ADO recordset object
Set rsVac1 = Server.CreateObject("ADODB.Recordset")
'initialise the strSGL variable with an SQL statement to query the database
strSQL = "SELECT * FROM [tblFeedLoader] WHERE [ClassificationID]='2' AND [ItemAction]='2' AND DATEDIFF(day, [ClosingDate], getdate())< 0 ORDER BY ID"
rsVac1.Open strSQL, adoCon
' Loop through the recordset to retrieve our rows of data.
while not rsVac1.eof
' The next 5 lines simply write out the remaining chunks of XML to complete the RSS file.
response.write "<item>" & NewLine
response.write " <title>"& ApplyXMLFormatting(rsVac1("Title")) & "</title>" & NewLine
response.write " <link>" & ApplyXMLFormatting(rsVac1("Link")) & "</link>" & NewLine
response.write " <description>" & ApplyXMLFormatting(rsVac1("Description")) & "</description>" & NewLine
response.write " <pubDate>" & ApplyXMLFormatting(fncFmtDate(rsVac1("PubDate"),"%a, %d %b %Y %H:%N:%S GMT")) & "</pubDate>" & NewLine
response.write "</item>" & NewLine & NewLine
' Loop
rsVac1.movenext
wend
' Close the recordset
set rsVac1 = nothing
' Write out the End Channel Data tag and End RSS tag.
%>
</channel>
</rss>