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

What's wrong with this simple update code?

Status
Not open for further replies.

JGKWORK

IS-IT--Management
Apr 1, 2003
342
GB
Can someone please tell me what's wrong with the update code below? The error is: "Object or provider is not capable of performing requested operation"

************

<html>
<head>
<title> msdasql - microsoft excel driver (*.xls) - testing update </title>
<script language=vbscript>

sub goupdate()

set oConn=createobject("ADODB.Connection")

oConn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=H:\Reports CC\folder.mdb;"


sCmd="select * from [Intranet_Counter]"

Set rs = oConn.Execute(sCmd)


Total= rs(0)+1
'document.write(Total)


rs(0) = Total+1
rs.Update



document.write "This page has been visited " & rs(0).value & " times. <p>"

rs.close
set rs=nothing
oConn.close
set oConn=nothing



end sub
</script>
</head>
<body onload="goupdate()">


</body>
</html>


********

Thanks.
 
First thing I see wrong is it is running on the client and ASP is run on the server

___________________________________________________________________

The answer to your ??'s may be closer then you think. faq333-3811
Join the Northern Illinois/Southern Wisconsin members in Forum1064
 
ADO should still run these operations though, I have ran the same update to an Excel spreadsheet no problem. ??
 
Yes but you're trying to run it on the client, not the server.
Try replacing the vb script tags by putting the code between these tags instead:

<HTML> . . .

<%

...vb script code....

%>

. . .
</HTML>

This way the code is performed on IIS before the page is served to the client browser.


 
Thanks, but managed it with the code below (I am not running IIS or any web server, this is running directly from a network drive and the file is a .htm extension).


<html>
<head>
<title> msdasql - microsoft excel driver (*.xls) - testing update </title>
<script language=vbscript>

sub goupdate()

set oConn=createobject("ADODB.Connection")

oConn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=H:\Reports CC\folder.mdb;"


sCmd="UPDATE Intranet_Counter SET Intranet_Counter.Total_Count = [total_count]+1;"
sCmd2="INSERT INTO tblIntranetAccess (accessedtime) SELECT Now() AS Expr1;"

Set rs = oConn.Execute(sCmd)
Set rs = oConn.Execute(sCmd2)



'document.write "This page has been visited " & rs(0).value & " times. <p>"

'rs.close
set rs=nothing
oConn.close
set oConn=nothing



end sub
</script>
</head>
<body onload="goupdate()">


</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top