我試圖搜索一個代碼來更新Classic-ASP中的Excel(XLS)文件,但是我無法讓它工作。更新Excel工作表(在經典的ASP/Vbscript中)
這裏是我有:
<!--#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「)& ";分機.. – 2012-03-08 16:26:27