ASP经典文本驱动程序在Windows 2012 [英] ASP Classic Text Driver For Windows 2012

查看:557
本文介绍了ASP经典文本驱动程序在Windows 2012的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个旧的ASP经典的网站已经在Windows 2003上运行,并且需要移动到2012年。

We have an old ASP Classic website which has been running on Windows 2003 and needs to be moved to 2012.

大部分的网站从这里我们需要能够上传CSV或Excel文档门类齐全到服务器的部分工作分开。

Most of the site works apart from a section where we need to be able to upload CSV or Excel documents full of categories to the server.

我不知道微软司机这就是为什么我们不得不离开该网站于2003年这么久的Windows 2008的时候存在,但我们正在试图无论是现在解决这个问题
对于Windows 2012 -finding正确的MS文本/ CSV / XLS驱动程序
-buying一个组件来为我们做的工作。

I know no Microsoft Driver existed at the time of Windows 2008 which is why we have had to leave the site on 2003 for so long but we are trying to solve this issue now either by -finding the correct MS Text/CSV/XLS driver for Windows 2012 -buying a component to do the job for us

搜索后,我发现这个MS KB文章> 的http:/ /www.microsoft.com/en-us/download/details.aspx?id=13255

After searching I found this MS KB article > http://www.microsoft.com/en-us/download/details.aspx?id=13255

它说但它应该做的工作,当我上载的Excel用下面的code这是我从知识库文章了。

Which says it should do the job however when I upload Excel with the following code which I have got from the KB article

Set objConnectionCSV    = Server.CreateObject("ADODB.Connection")       
Set objCSVRecs      = Server.CreateObject("ADODB.Recordset")

'* Get path and extension of uploaded file - earlier on using ASPUpload
strPath = objFile.Path
strExt  = lcase(Right(strPath,Len(strPath)-InStrRev(strPath,".")))  

'* try with new driver code
With objConnectionCSV
.Provider = "Microsoft.ACE.OLEDB.12.0"              

'* it errors on this line!
.Open "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & strPath & ";"""

'* old code which I don't get to which required data to be on sheet 1
On Error Resume Next
Set objCSVRecs = .Execute("[Sheet1$]") 
If Err.number <> 0 Then
    strErrMessage   = "Error opening file: " & Err.number & " " & Err.Description & ";"
    Err.Clear                       
End If
End With

我上线这个错误

。开驱动程序= {Microsoft Excel驱动程序(的* .xls,* .XLSX,* .XLSM,* .xlsb)}; DBQ =&放大器; strPath的&安培; ;,

.Open "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & strPath & ";"""

Microsoft Access数据库引擎错误80004005

Microsoft Access Database Engine error '80004005'

找不到可安装ISAM。

Could not find installable ISAM.

这是正确的文本驱动程序?

Is this the right text driver?

请问做别的事情需要例如IIS设置的或不同的code?

Does something else need to be done e.g IIS settings or different code?

我们已经重新启动IIS和权限发挥四周,它在64位模式运行。

We have restarted IIS and played around with permissions and it's running in 64 bit mode.

有没有人有一个解决这个问题,或者知道一个解决方法如我可以使用/购买组件的,因为我不希望有开始在这个时间点在ASP中的经典写文件分析器自己。

Does anyone have a solution to this problem or know of a workaround e.g a component I could use/buy as I don't want to have to start writing a file parser in ASP classic myself at this point in time.

即使我只能处理CSV文件,而不是XLS,XLSX等那么这将是不够好,但我只需要知道code使用的,正确的连接字符串和任何安装或在IIS中设置。

Even if I can only handle CSV files and not XLS,XLSX etc then that would be good enough but I just need to know the code to use, the correct connection string and anything to install or set in IIS.

感谢您的帮助提前。

推荐答案

它看起来像在同一时间正在使用OLEDB和ODBC。

It looks like OLEDB and ODBC are being used at the same time.

OLEDB

.Provider = "Microsoft.ACE.OLEDB.12.0"              

ODBC

.Open "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & strPath & ";"""

由于这些数据源API是完全不同的,并且完成相同的任务。这里是一个计算器的回答其中讨论的差异。

删除或注释掉这一行。

.Provider = "Microsoft.ACE.OLEDB.12.0" 

更新

替换

Set objCSVRecs = .Execute("[Sheet1$]") 

Set objCSVRecs = .Execute("SELECT * FROM [Sheet1$]")

下code是在Windows 2012 R2虚拟机的设置。

The code below was setup on a Windows 2012 R2 VM.

考虑:一个Excel s的领域ID preadsheet,姓氏,名字为这个演示创建

Given: An Excel spreadsheet with the fields id, LastName, FirstName was created for this demo.

<%
Set objConnectionCSV    = Server.CreateObject("ADODB.Connection")       
Set objCSVRecs      = Server.CreateObject("ADODB.Recordset")

'Important: Be sure your strPath variable contains a value. For testing purposes, I hard coded a value.
strPath = objFile.Path
strExt  = ".xlsx"  

'Opening tags for asp page
response.write "<html><body>"

With objConnectionCSV  
    .Open "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" & strPath & ";"""

    On Error Resume Next
    Set objCSVRecs = .Execute("select * from [Sheet1$]") 

    Do While Not objCSVRecs.EOF
            response.write "Data row: " & objCSVRecs("id").Value & " Name = " &  objCSVRecs("LastName").Value & ", " & objCSVRecs("FirstName").Value & "<br/>" 
        objCSVRecs.MoveNext
    Loop

    If Err.number <> 0 Then
        strErrMessage   = "Error opening file: " & Err.number & " " & Err.Description & ";"
        Err.Clear                       
    End If
End With

'End tags for asp page
response.write "</body></html>"
%>

结果

这篇关于ASP经典文本驱动程序在Windows 2012的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆