Dataset, Datatables and Excel data

G

Guest

Hi,

I am having an issue with accessing Excel spreadsheets using OLEDb.

I am able to connect to the spreadsheet and perform a 'select *', from the
named worksheet, but I want to be able to select colname1, colname2 etc.

Is it possible to do more than a select * from excel worksheet ???

If not, is it possible to somehow take the data from excel, put it into some
other tabe, say a datatable, and then do a select from that table to get
just the data I need.

Thanks
 
G

Guest

Hi,

Thanks for the answer..

I have taken a look at the project, but its C#, so having a bit of troubling
finding what I need from it.

All I am trying to is select only certain columns from the worksheet, but
can not get anything apart from select * to work. Doing a select A, B from
[sheet1$] causes an error.

Thanks
 
S

sloan

Its not that hard of a (mental) conversion. Especially the DataLayer.

Run the project. It will run straight from an unzip with Excel.

Do a search for this line:
DbCommand dbc = db.GetSqlStringCommand(EXCEL_CUSTOMERS_SELECT_QUERY);

and put a breakpoint on it.

When you're on the entry screen:
Pick the Excel radio button on the winform.








NoSpamMan said:
Hi,

Thanks for the answer..

I have taken a look at the project, but its C#, so having a bit of
troubling finding what I need from it.

All I am trying to is select only certain columns from the worksheet, but
can not get anything apart from select * to work. Doing a select A, B
from [sheet1$] causes an error.

Thanks


sloan said:
You can find an example of select (not *) with Excel at:

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!176.entry

Code sample is downloadable.
 
C

Cor Ligthert[MVP]

If not, is it possible to somehow take the data from excel, put it into
some other tabe, say a datatable, and then do a select from that table to
get just the data I need.

What is your problem with that, because this is so easy to do.
Probably not for you now, but giving an answer because is so simple is to
much guessing
 

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