我最近继承了用Visual Basic和Java Script编写的经典ASP应用程序。我不是程序员,但是在VBA中使用Excel和access编写了一些应用程序。
我正在寻找一个脚本,以使用ADODB记录集将Excel(.xlsx)工作表复制到访问(.accdb)表中。我在VBA中使用了这种方法,但是asp classic中的Visual Basic代码无法识别记录集对象的Locktype或Options属性。如果删除.Options和.Locktype,脚本将运行,但只能在只读模式下运行,而我无法添加新记录。
adPath = Server.Mappath("OutageData/QHT.accdb")
Set cnnaccess = Server.CreateObject("ADODB.Connection")
with cnnaccess
.Provider="microsoft.ACE.OLEDB.12.0"
.Open adpath
end with
Set rstaccess = Server.CreateObject("ADODB.Recordset")
with rstaccess
.activeConnection=cnnaccess
.CursorType=adOpenDynamic
.Options=adCmdTable
.LockType=adLockOptimistic
.cursorlocation=aduseclient
.Open "TST1UPDT"
end with
有什么建议吗?
Thx
基思