如何解决连接字符串的问题? [英] How to solve the problem connection string?
本文介绍了如何解决连接字符串的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
下面有两个连接字符串,我试过了两个。但是,我得到了同样的错误。
如何解决?
string conString = string .Format( @ Provider = Microsoft.ACE.SQLOLEDB.12.0;数据源= {0};扩展属性= Excel 12.0,Server.MapPath(dosya));
string conString = string .Format( @ Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Extended Properties = Excel 8.0; HDR = Yes; IMEX = 1
未在 ConnectionString中指定OLE DB提供程序。例如,' Provider = SQLOLEDB;'。
解决方案
http://codehill.com/2009/ 01 / reading-excel-2003-and-2007-files-using-oledb / [ ^ ]
将此资源用于所有连接字符串需求,
T他的连接字符串参考 [ ^ ]
Excel连接字符串 [ ^ ]
希望它有所帮助。
您是否尝试使用实际文件名而不是{0}
strConnect = _T( Provider = Microsoft.Jet.OLEDB.4.0;
数据源= C:\\DatabasePath \\DBSpreadSheet.xls;
扩展属性= \\Excel 8.0; HDR =是; \\;);
Hello guys,
There are 2 connection strings below and I tried both..However, I got same error.
How can I solve it?
string conString = string.Format(@"Provider=Microsoft.ACE.SQLOLEDB.12.0;Data Source={0};Extended Properties=Excel 12.0", Server.MapPath(dosya));
string conString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;HDR=Yes;IMEX=1"
An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
解决方案
http://codehill.com/2009/01/reading-excel-2003-and-2007-files-using-oledb/[^]
Use this resource for all your connection string needs,
The Connection String Reference [^]
Excel Connection Strings [^]
Hope it helps.
Have you just tried with actual filename instead of {0}
strConnect = _T("Provider=Microsoft.Jet.OLEDB.4.0;" "Data Source=C:\\DatabasePath\\DBSpreadSheet.xls;" "Extended Properties=\"\"Excel 8.0;HDR=Yes;\"\";");
这篇关于如何解决连接字符串的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文