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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Provider error '80004002' No such interface supported

Status
Not open for further replies.

tripm8

Programmer
Jun 2, 2004
13
0
0
GB
I am currently in the process of changing a website from an sql database into an access database, and I have encountered an error when opening up the database from an external file when doing certain processes. The error i recieve is:

Provider error '80004002'


No such interface supported

/Refs/opendb.asp, line 28

and the code on that page is:-

<!--#include virtual="/Refs/SecureIt.asp"-->
<%
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
Const adUseServer = 2
Const adUseClient = 3
Const adCmdTableDirect = 512
Const adCmdText = &H0001
Dim conn, DataBase, dbProvider
DataBase = Server.MapPath("/db/db.mdb")
Provider = "Microsoft.Jet.OLEDB.4.0"

Set conn = Server.CreateObject("ADODB.Connection")
With conn
.Provider = Provider
' .MODE = &H10
.Open DataBase

End With

%>

If anyone can see what the error is and what is wrong with the code i would be very grateful.
 
Not sure it's a problem, but you dim'd one thing and used another

Dim conn, DataBase, dbProvider
DataBase = Server.MapPath("/db/db.mdb")
Provider = "Microsoft.Jet.OLEDB.4.0"

Did you mean

Dim conn, DataBase, dbProvider
DataBase = Server.MapPath("/db/db.mdb")
dbProvider = "Microsoft.Jet.OLEDB.4.0"

And, of course

With conn
.Provider = dbProvider

It could be a problem with a reserved word in using the word 'provider' as a variable.
 
Thanks for pointing that out MoLaker.

It hasn't solved the original problem though.

Any more suggestions would be very helpful.
 
see if This helps!

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
Thanks onpnt, that was a very usefularticle but unfortunately it hasnt helped me find the solution to our problem, we have MDAC v7 installed on the server and it appears we have done everything else in the article.
 
what version of IE are you running?

Are you able to hit any databases with the OLEDB string?

I would try a simply select on a different DB with a fresh page. That would troubleshoot it being the system over the page

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
onpnt i have tried ie 5 and ie6 and mozilla and error occurs on each. I have also tried several machines including win98, 2000 and xp and it is always the same error. So i believe it is a scripting problem rather than a machine problem.

Most of the time the database connects properly and we can read and write to the database, the error only occurs on one page, when you try and bid on an item (it is an auction type site)

the code of the page that causes the problem is


<!--#include virtual="/Refs/opendb.asp"-->
<!--#include virtual="/Refs/ValidateUser.asp"-->
<%
Dim RS, errMsg

Set RS = conn.execute("SELECT * FROM tbdAuctionInfo WHERE fldAuctionID = " & Request("AuctionID") & "")
' #### If RS("fldAuctionDate") <> Date() OR (RS("fldAuctionTime") < Time() AND DateDiff("h", RS("fldAuctionTime"), Time()) > RS("fldAuctionDuration")) Then

If DateDiff("h", RS("fldAuctionDate") & " " & RS("fldAuctionTime"), Now()) >= 0 Then
' The auction start time should have passed
If DateDiff("n", RS("fldAuctionDate") & " " & RS("fldAuctionTime"), Now()) < RS("fldAuctionDuration")*60 Then
' We are below the end time of the auction
If Request.Form("Bid") <> "" Then
server.execute("/Auction/BidTrans.asp")
End If
Else
errMsg = "This auction has now finished"
End If
Else
errMsg = "This auction has not yet started. Try again later"
End If

If RS("fldAUctionType") = "N" Then
AuctionType="Normal"
If IsNull(RS("fldReservePrice")) Then
GuidePrice = "No Reserve Specified"
Else
GuidePrice = "Reserve Price: " & ExchangeUnits & FormatNumber(RS("fldReservePrice")*ExchangeRate, 2)
End If
Else
AuctionType="Reverse Tender"
If IsNull(RS("fldReservePrice")) Then
GuidePrice = "No Guide Specified"
Else
GuidePrice = "Guide Price: " & ExchangeUnits & FormatNumber(RS("fldReservePrice")*ExchangeRate, 2)
End If
End If



%>
<html>
<head>
<title>Bid</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/main.css" type="text/css">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body bgcolor="#F7E4AA" text="#000000" topmargin="0" onLoad="MM_preloadImages('/new%20buttons/exit_auction/images/exit_auction_f2.gif')">
<table width="100%" border="0">
<tr>
<td width="36%"><font face="Arial, Helvetica, sans-serif" size="2"><% If Request("Buyer") = "" Then Response.Write("Please enter your bid in the box below. <BR> Please type only numbers, do NOT include £, $ etc") %></font></td>
<td width="38%" rowspan="2" align="center" valign="middle">
<div align="center">
<b>
<p><font face="Arial, Helvetica, sans-serif" size="2">Bidding as <%= UserName %><br>
Auction Type: <%= AuctionType %><br>
<%= GuidePrice %></font>
</p>
</b>
<p><a href="/Auction/Menu.asp?ID=<%= Request("ID") %>" target="_top" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Exit Auction','','/new%20buttons/exit_auction/images/exit_auction_f2.gif',1)"><img name="Exit Auction" border="0" src="/new%20buttons/exit_auction/images/exit_auction.gif" width="99" height="22"></a></p>
</div>
</td>
<td width="26%" rowspan="2" align="right"><img src="/Images/george_logo.gif" width="100" height="100"></td>
</tr>
<tr>
<td width="36%">
<%
If Request("Buyer") = "" Then
%>
<form action="Bid.asp?ID=<%= Request("ID") %>&AuctionID=<%= Request("AuctionID") %>&CustomerID=<%= Request("CustomerID") %>" method="POST" name="BidForm">
<input type="text" name="Bid" class="textboxes2">
<input type="Image" name="Action" value="Submit Bid" src="/new%20buttons/bid/images/bid.gif" width="50" height="21" align="middle">
<BR><%= errMsg %>
</form>
<%
End If
%>
</td>
</tr>
</table>
</body>
</html>
 
is this file used in otehr applications and working properly?
opendb.asp

if not acn you post that code.

also are you expecting the page to stop loading upon this condition

If Request.Form("Bid") <> "" Then
server.execute("/Auction/BidTrans.asp")
End If

if so Response.End it.
Other you need to put it with in the page body if it is outputting any client source.

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
may I also suggest cleaning the code up so it's more manageable

Code:
Dim compFirst
Dim compSecond
Dim RS, errMsg

Set RS = conn.execute("SELECT * FROM tbdAuctionInfo WHERE fldAuctionID = " & Request("AuctionID"))

compFirst = DateDiff("h", RS("fldAuctionDate") & " " & RS("fldAuctionTime"), Now())
'test
'Response.Write compFirst
compSecond = DateDiff("n", RS("fldAuctionDate") & " " & RS("fldAuctionTime"), Now())
'test
'Response.Write compSecond



If compFirst >= 0 Then

    If compSecond < RS("fldAuctionDuration")*60 Then

        If Request.Form("Bid") <> "" Then
            server.execute("/Auction/BidTrans.asp")
            'Response.End 
        End If
        
    Else
        
        errMsg = "This auction has now finished"
    
    End If

Else

    errMsg = "This auction has not yet started. Try again later"

End If

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
thanks.....opendb.asp is the code i posted in the 1st message of this thread, it is used on every DB page on the site and i have only found this one page with the problem.

I realise i need to clean up the code, but it is the code i adopted from the previous SQL site and want to get it working 1st before i improve efficiency.
 
sorry tripm8

I'm jsut trouble shooting things here -- I haven't run into that particular error and to say the least it doesn't mean much in terms of WHY it is occuring.

If the error is pointing to the opendb page then I'm sure the code is fine. besdies the code will not very from back end source to back end source. just the SQL construct and the connections

So -- how about a bit of simplifying things in that connection incldue
e.g. (replace all with)
Code:
Dim connString

Set conn = Server.CreateObject("ADODB.Connection")
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/db.mdb")

conn.Open(connString)

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
Thanks onpnt I have simplified the connections file as suggested but the same error appears..just a differant line number. Error pointing to the

conn.Open(connString) line
 
try a different database

that's telling me it may be corrupt

___________________________________________________________________
[sub]
The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
[/sub]
 
ok cheers onpnt, i have gotta get out of the office now before they lock me in. Will let you know how i get on.

Thanks again for all your help!
 
I think i found the problem,

on the page there was a line of code:-

Code:
<%@ LANGUAGE=VBScript TRANSACTION=Required %>

took that out and it all apears to be working fine.

onpnt your help was very much appreciated I wouldnt of been able to do it without you!! cheers again! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top