Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2004, 11:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Excel as Data Source

Hello,

Is it possible to specify an Excel spreadsheet as a data source through ADO.NET? I read somewhere that it is possible... Would you use the OLEDB objects (OLEDBConnection, OLEDBDataAdapter, etc) to connect to it? What does your connection string have to look like?

Thanks,

Brian Mains
__________________
Brian
 
Old February 5th, 2004, 02:17 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use your excel file as source and use following method to connec to it:

string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\ExcelToXml\\foodgroup.xls;" +
"Extended Properties=Excel 8.0";
OleDbConnection objConn = new OleDbConnection(strConn);

hope this helps.
Bharat Gadhis

Bharat Gadhia
 
Old February 5th, 2004, 04:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

OK. I Didn't know you used the Microsoft JET provider to get to it. Learn something every day.

Thanks a lot.





Similar Threads
Thread Thread Starter Forum Replies Last Post
data source... rupen Access VBA 5 August 1st, 2007 06:10 AM
Converting excel data to Access using excel VBA ShaileshShinde VB Databases Basics 1 April 26th, 2006 07:57 AM
Advanced DataGrid from Excel Source cilynx Classic ASP Professional 0 July 20th, 2005 10:12 AM
Pivot tables in Excel with cubes as data source boson SQL Server 2000 2 January 28th, 2005 07:16 AM
Updating SQL DB from Excel Source Arsi SQL Server 2000 4 August 30th, 2004 12:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.