PDA

Click to See Complete Forum and Search --> : Totally random Provider error '80004005' unspecified error


monte96
Nov 6th, 2000, 10:56 PM
Can't tell much w/o code...

IClarke
Nov 7th, 2000, 03:44 AM
This is what i'm using to set-up the connection and get the recordset :

<%
Set Con = Server.CreateObject ("ADODB.Connection")
Con.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\InetPub\wwwroot\development\News.mdb"

set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "SELECT Title, ID FROM NewsArticles WHERE ID > ((SELECT MAX(ID) from NewsArticles)-3) ORDER BY ID DESC", Con, 3, 3
%>

This is how the recordset is used :

<font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><b>
<p><a href="newsarticle.asp?ID=<%=rs("ID")%>"><%=rs("Title")%></a></p>
<%rs.MoveNext%>
<p><a href="newsarticle.asp?ID=<%=rs("ID")%>"><%=rs("Title")%></a></p>
<%rs.MoveNext%>
<p><a href="newsarticle.asp?ID=<%=rs("ID")%>"><%=rs("Title")%></a></p>
</b>
</font>

I then close recordset and connection at the end of the page :

<%
rs.Close
Con.Close
%>

IClarke
Nov 7th, 2000, 08:05 AM
Ok i think i found the problem, there was a problem with the database that was causing only 2 records to be retreived and not 3 like the page was expecting, this was causing the page to error and not get to the end and hence not close the database connection etc.

Thats what i THINK was going on anyway ...

monte96
Nov 7th, 2000, 10:15 AM
For starters, why are you using the ODBC driver for Access instead of the OLEDB provider?


Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\InetPub\wwwroot\development\News.mdb;Persist Security Info=False"


'Loop through the recordset:

<font face="Arial, Helvetica, sans-serif" size="2" color="#000000"><b>
<%Do until rs.EOF%>
<p><a href="newsarticle.asp?ID=<%=rs.Fields("ID")%>"><%=rs.Fields("Title")%></a></p>
<%rs.MoveNext
Loop%>
</b></font>


Also your ORDER BY clause needs a comma to deparate ID and DESC.

IClarke
Nov 7th, 2000, 10:23 AM
Thanks for the info, looping through the recordset is a good idea and would have actually solved my problem, i really have no excuse for not thinking of it in the first place ! :)

One thing i don't get though ... can you explain what the difference is between my connection string and the one you suggested as what I am using IS working, would the be a benefit to doing it your way?

Best Regards
Ian.

monte96
Nov 7th, 2000, 08:17 PM
ODBC is slower than OLEDB.

In fact, I can't think of ANY reason to use the Access ODBC driver... not even sure why they supply one for windows based platforms...