為什麼不能執行以下語句
select * from openDataSource('Microsoft.Jet.OLEDB.4.00', 'Data Source="E:\1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...sheet錯誤提示
Server: Msg 7403, Level 16, State 1, Line 1
Could not locate registry entry for OLE DB provider 'Microsoft.Jet.OLEDB.4.00'.
OLE DB error trace [Non-interface error: Provider not registered.].
請高手幫幫忙!原貼子如下
http://www.csdn.net/develop/read_article.asp?id=18623
select * from openDataSource('Microsoft.Jet.OLEDB.4.00', 'Data Source="E:\1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...sheet錯誤提示
Server: Msg 7403, Level 16, State 1, Line 1
Could not locate registry entry for OLE DB provider 'Microsoft.Jet.OLEDB.4.00'.
OLE DB error trace [Non-interface error: Provider not registered.].
請高手幫幫忙!原貼子如下
http://www.csdn.net/develop/read_article.asp?id=18623
解决方案 »
- VB调用ACCESS数据库如何刷新?
- 玩个题目吧,不要运行代码,说说打印出来的结果是啥?
- 如何用VB画单柱图???????????????????????????能给多少分给多少!!我着急!!!!!谢谢
- 我是初学VB 请问vb 中DataReport 控件怎么用
- DBGRID怎样才可得到呢?
- ★★概率题★★
- MSMASK32.OCX是一个什么文件,能发给我吗?
- 什么是crystal report?
- 谁有b/s模式的数据库源代码?
- to zhengsb(Rainbow): 你刚发的贴子中说找到了activereport中动态字段报表的例子,请问是哪个例子呢?真的能让用户自己选择要打印的字段吗?
- 请教:我采用DataGrid显示数,因为列数太多要不断地拉动滚动条,有方法可以在当前画面上全部显示吗?
- 有什么办法让mshflexgrid根据显示的数据内容自动调整大小吗?
你可以这样:
db.open "Microsoft.Jet.OLEDB.4.00', 'Data Source="E:\1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0"
rs.open "select * from sheet1 where ...",db
錯誤提示
Data source Name not found and no default driver specifedolo朋友你的例子有測試過是可行的嗎?能否告訴我?我查了很多資料發現我的sql是沒錯的,csdn 上在sql-server 中也有類似的問題,但是都沒有
得到解決?
有高手能幫小弟嗎?
OPENDATASOURCE
Provides ad hoc connection information as part of a four-part object name without using a linked server name.Syntax
OPENDATASOURCE ( provider_name, init_string )Arguments
provider_nameIs the name registered as the PROGID of the OLE DB provider used to access the data source. provider_name is a char data type, with no default value.init_stringIs the connection string passed to the IDataInitialize interface of the destination provider. The provider string syntax is based on keyword-value pairs separated by semicolons, that is, "keyword1=value; keyword2=value."The basic syntax is defined in the Microsoft® Data Access SDK. Refer to the documentation on the provider for specific keyword-value pairs supported. This table lists the most commonly used keywords in the init_string argument.Keyword OLE DB property Valid values and Description
Data Source DBPROP_INIT_DATASOURCE Name of the data source to connect to. Different providers interpret this in different ways. For SQL Server OLE DB provider, this indicates the name of the server. For Jet OLE DB provider, this indicates the full path of the .mdb file or .xls file.
Location DBPROP_INIT_LOCATION Location of the database to connect to.
Extended Properties DBPROP_INIT_PROVIDERSTRING The provider-specific connect-string.
Connect timeout DBPROP_INIT_TIMEOUT Time-out value after which the connection attempt fails.
User ID DBPROP_AUTH_USERID User ID to be used for the connection.
Password DBPROP_AUTH_PASSWORD Password to be used for the connection.
Catalog DBPROP_INIT_CATALOG The name of the initial or default catalog when connecting to the data source.
Res
The OPENDATASOURCE function can be used in the same Transact-SQL syntax locations as a linked server name. Thus, OPENDATASOURCE can be used as the first part of a four-part name that refers to a table or view name in a SELECT, INSERT, UPDATE, or DELETE statement, or to a remote stored procedure in an EXECUTE statement. When executing remote stored procedures, OPENDATASOURCE should refer to another SQL Server. OPENDATASOURCE does not accept variables for its arguments.Like the OPENROWSET function, OPENDATASOURCE should only reference OLE DB data sources accessed infrequently. Define a linked server for any data sources accessed more than a few times. Neither OPENDATASOURCE, nor OPENROWSET provide all the functionality of linked server definitions, such as security management and the ability to query catalog information. All connection information, including passwords, must be provided each time OPENDATASOURCE is called.Examples
This example accesses data from a table on another instance of SQL Server.SELECT *
FROM OPENDATASOURCE(
'SQLOLEDB',
'Data Source=ServerName;User ID=MyUID;Password=MyPass'
).Northwind.dbo.CategoriesThis is an example of a query against an Excel spreadsheet through the OLE DB provider for Jet.SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...xactions
See Also
我錯在哪里 ?嗚嗚!
看看
我試過了,錯誤和我第一貼的錯誤是一樣的?
你可以这样:
db.open "Microsoft.Jet.OLEDB.4.00', 'Data Source="E:\1.xls";User ID=Admin;Password=;Extended properties=Excel 5.0"
rs.open "select * from sheet1 where ...",db
FROM OpenDataSource ( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...xactions