O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Read an Excel File with ADO.NET

Problem

You want to retrieve or insert data in a Microsoft Excel document using ADO.NET.

Solution

Use the ODBC provider in conjunction with the Microsoft Excel ODBC Driver.

Discussion

There’s no managed provider or OLE DB provider for Excel. However, you can use the Microsoft Excel ODBC driver, which is installed by default with Excel, in conjunction with the ODBC .NET provider. The ODBC .NET provider is included with the .NET Framework 1.1 (and Visual Studio .NET 2003). If you are using .NET Framework 1.0, you can download the ODBC .NET provider as an add-on from the MSDN site at http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp.

In your connection string, you’ll need to specify the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required