How to Transfer an Excel Range to an ADO.Net DataSet or DataTable in VB.Net?

T

TCook

Hey All,

I've seen lots of stuff regarding pumping data into Excel from .Net but
haven't found anything for the reverse.

Does anyone have a snippet, article ID, etc. demonstrating how to take a
range object and pump that data into an ADO.Net DataSet?

Thanks,

TC
 
R

rowe_newsgroups

You handle this the same way you handle other data sources. First get
your connection string from www.connectionstrings.com and then proceed
to use ADO.NET to connect and read from the excel file.

Thanks,

Seth Rowe
 
P

Paul Clement

¤ Hey All,
¤
¤ I've seen lots of stuff regarding pumping data into Excel from .Net but
¤ haven't found anything for the reverse.
¤
¤ Does anyone have a snippet, article ID, etc. demonstrating how to take a
¤ range object and pump that data into an ADO.Net DataSet?

See the following MS KB article:

How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
http://support.microsoft.com/kb/316934


Paul
~~~~
Microsoft MVP (Visual Basic)
 
T

TCook

Hey Guys,

I don't think that I was quite clear.

Using a range object, is there a quick way to blast the data into a
datatable?

For example, using a range object, one can dump the data to an array. Is
there a way to do something similar with a range object and a datatable?

Is there a quick way to dump the data from an array into a datatable?

I won't be using connection strings, etc. I will be using range objects.

Thanks & Regards,

TC
 
C

Cindy M.

Hi TCook,
For example, using a range object, one can dump the data to an array. Is
there a way to do something similar with a range object and a datatable?
Not a .NET datatable, no. Excel (like most "traditional" Office apps) is
blissfully ignorent of all things .NET. Putting the range data into an
array, then that into the data table is probably your fastest choice if you
can't use a connection.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top