[英]SQL Server table export to Excel issue
I am using 64-bit Windows Server 2008 with SQL Server 2008. And Using VS2008 + C# + .Net 2.0 + IIS 7.0 + ASP.Net. 我使用的是64位Windows Server 2008和SQL Server 2008.并使用VS2008 + C#+。Net 2.0 + IIS 7.0 + ASP.Net。 When executing the following statement, I met with the following error (the error occurs when accessing an aspx page), I am not sure whether it is 64-bit system specific issue?
执行以下语句时,遇到以下错误(访问aspx页面时发生错误),我不确定这是否是64位系统特定的问题?
Sys.WebForms.PageRequestManagerServerErrorException: unregistered OLE DB access interface "Microsoft.Jet.OLEDB.4.0"
StringBuilder sb = new StringBuilder();
sb.AppendLine("select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 8.0;HDR=YES;DATABASE=" + s_path.Trim() + "',sheet1$) where name is not null"); //e:\\test1.xls
DataSet ds = SqlUtil.ExecuteDataset(Database.StrConn, CommandType.Text, sb.ToString());
if (ds.Tables[0].Rows.Count > 0)
{
GridView_Tlinkmans.DataSource = ds;
GridView_Tlinkmans.DataBind();
}
You have one or 2 issues: 你有一两个问题:
You are querying OPENROWSET in SQL Server and you have x64 SQL Server, you may need the MDAC to bridge SQL Server to ODBC/OLEDB . 您正在SQL Server中查询OPENROWSET并且您有x64 SQL Server,您可能需要MDAC将SQL Server桥接到ODBC / OLEDB 。 However, this says it is part of the OS for Win 2008+.
但是,这表明它是Win 2008+操作系统的一部分。 I've had to install on Win 2003
我必须在Win 2003上安装
Then you probably need this which is the closest to JET I know of: Microsoft Access Database Engine 2010 Redistributable 然后你可能需要这个最接近我知道的JET: Microsoft Access数据库引擎2010可再发行组件
YMMV 因人而异
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.