【发布时间】:2012-03-08 16:20:16
【问题描述】:
我尝试在 Classic-ASP 中搜索可更新 Excel (XLS) 文件的代码,但无法正常工作。
这是我所拥有的:
<!--#include file="../adovbs.inc"-->
<%
' Open and Update and then Close The XLS File
Dim objConn
set objConn = Server.CreateObject("ADODB.Connection")
Dim FLConnect
Dim strSQLexcel
' Create the connection string.
FLConnect = "Provider=Microsoft.Jet.OLEDB.4.0 Data Source=" & Server.MapPath("TEST.xls") & "Extended Properties='Excel 8.0;HDR=No'"
' Create the SQL statement.
strSQLexcel= "UPDATE [Sheet1$A1:A1] SET F1='TestValue1'"
set objConn = Server.CreateObject("ADODB.Recordset")
'Set objConn = New ADODB.Connection
' Create and open the Connection object.
objConn.Open FLConnect
' Execute the insert statement.
objConn.Execute strSQLexcel
' Close and destroy the Connection object.
objConn.Close
%>
但我不断收到错误消息:“连接不能用于执行此操作。在此上下文中它已关闭或无效。”
非常感谢...
【问题讨论】:
-
用缺失的试试看; - ...xls") & "Ext.. - ...xls") & ";Ext..
标签: asp-classic vbscript