asp excel 我需要做的是把excel里面的内容读取到asp中.
Assembly code
excel=request("file1")
Dim db,rs,strSql
Set db = Server.CreateObject("ADODB.Connection")
db.Open "Driver={Microsoft Excel Driver (*.xls)};Dbq=" & Server.MapPath(excel)
strSql="Select * From [Sheet1$]"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open strSql, db
假如我这样做的话.一点问题都没有.可是刷新后就出错
microsoft jet数据引擎打不开文件,它以被别的用户以独占方式打开,或没有查看数据的权限。
等过了几分钟又能用了
------解决方案--------------------
excel=request("file1")
Dim db,rs,strSql
Set db = Server.CreateObject("ADODB.Connection")
Driver = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;"
DBPath = "Data Source="&Server.MapPath(excel)
db.Open Driver & DBPath
strSql="Select * From [Sheet1$]"
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open strSql, db