Jet Vs Access Drivers

D

daddywhite

Guest
I have built a site which holds its HTML content in a database. A unique ID refers to the page id and a database connection retreives the page title and content.

I was using the Jet Driver, as below:
<%
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../private/info.mdb")
%>

This works fine but occasionally I get "Unspecified Error" and stuff like that which I am told is attributed to using the Jet Driver on my chosen host.

I was therefore advised to use the Acess Driver as below:

<%strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="&Server.Mappath("..\private\info.mdb")%>

This connects fine and displays the page title fine, but it appears to crash on the content field!!

<%str = adoRs("content")
a1 = InStr(1,str,"<%")

if a1=0 then
response.write Mid(str,1)
str=""
else
response.write Mid(str,1,a1-1)
str=Mid(str,a1+2)
end if
%>

It is on this line:

<%response.write Mid(str,1,a1-1)%>

that my code crashes with a: "Invalid Use of Null" ASP error message.

When I revert back to the JET Driver, it works fine!!

Note:
Changing

<%str = adoRs("content")%>

to

<%str=adoRs.Fields.Item("content").Value%>

appears to fix the problem??!?!

Any particular reason why or any solutions to this?? Thanks.
 
Back
Top