You receive error messages when you try to use ADO.NET OLEDbDataAdapter to modify an Excel workbook (316756)
The information in this article applies to:
- Microsoft ADO.Net 2.0
- Microsoft Office Excel 2003
- Microsoft Excel 2002
- Microsoft Excel 2000
- Microsoft ADO.NET (included with the .NET Framework) 1.0
This article was previously published under Q316756 SYMPTOMS When you try to add, to update, or to delete records in an
Excel workbook that uses the OLEDbDataAdapter with ADO.NET, you receive one of the following error messages:
When you add a record: Syntax error in INSERT
INTO statement. When you update a record:
Dynamic SQL generation for the UpdateCommand is not supported against a
SelectCommand that does not return any key column information. When
you delete a record: Dynamic SQL generation for the
DeleteCommand is not supported against a SelectCommand that does not return any
key column information. CAUSE The Microsoft Jet OLE DB provider does not return key or
index information for Excel workbooks. Therefore, the OLEDbCommandBuilder cannot automatically generate SQL statements to perform the
intended action. RESOLUTION To resolve this problem when you insert new records by
using the OLEDbDataAdapter, you must provide primary key information through the InsertCommand member of the adapter. To modify existing records, you must
provide primary key information through the UpdateCommand member.
The Jet OLE DB provider does not support delete
operations for Excel workbooks. Therefore, you cannot delete records in a
workbook by using ADO or ADO.NET. STATUSThis
behavior is by design.REFERENCES For additional information, see the following Microsoft
Developer Network (MSDN) Web site:
For additional informationabout using InsertCommand or UpdateCommand to update Excel workbooks, click the following article number to view the article in the Microsoft Knowledge Base:
316934
HOW TO: Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
Modification Type: | Minor | Last Reviewed: | 3/9/2006 |
---|
Keywords: | kbtshoot kberrmsg kbprb KB316756 kbAudDeveloper |
---|
|