Connecting Tech Pros Worldwide Forums | Help | Site Map

Accessing excel files from C#

Mike Grishaber
Guest
 
Posts: n/a
#1: Nov 16 '05
Does anyone know how to read an Excel file using C# and treat the resluts as
RecordSets?

Thanks

Mike


Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
#2: Nov 16 '05

re: Accessing excel files from C#


Mike,

Do you mean ADODB recordsets, or a data set? If you mean ADODB
recordsets, then you can use COM interop and use the JET OLE DB Provider to
get a recordset in C#.

If you mean a DataSet, then you will have to use COM automation to
access Excel, and get the information programatically to populate the
DataSet.

The Knowledge base article 316126, titled "HOW TO: Use Visual C# .NET to
Automate a Running Instance of an Office Program" should help, it is located
at (watch for line wrap):

http://support.microsoft.com/default...b;en-us;316126

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Mike Grishaber" <mgrishaber@cp.org> wrote in message
news:oPImd.26080$Ho4.1102219@news20.bellglobal.com ...[color=blue]
> Does anyone know how to read an Excel file using C# and treat the resluts
> as
> RecordSets?
>
> Thanks
>
> Mike
>
>[/color]


Shiva
Guest
 
Posts: n/a
#3: Nov 16 '05

re: Accessing excel files from C#


Hi,
If you meant using ADO.NET (no RecordSets), then check this one:
http://support.microsoft.com/kb/306572

For ADO (with RecordSets), see if this helps:
http://support.microsoft.com/kb/306023

"Mike Grishaber" <mgrishaber@cp.org> wrote in message
news:oPImd.26080$Ho4.1102219@news20.bellglobal.com ...
Does anyone know how to read an Excel file using C# and treat the resluts as
RecordSets?

Thanks

Mike



Closed Thread