views:

118

answers:

2

I have the following database defined in app.config now:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\table.mdb

can I use excel instead as datasource there? are there any limits if I use excel file, the database is simple 300 rows, and it would be more handy to use excel file.

does excel need to be readonly?

+1  A: 

Yes you can use Excel as a Data Source.

e.g. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

The details can be found at http://www.connectionstrings.com/excel

The document doesn't need to be readonly

JDunkerley
thanks, where do I define [sheet1$]
Tom
[Sheet1$] is the name of the first sheetIf you have a named range I believe they exist as table names (if memory serves, has been a long time since I used these).
JDunkerley
A: 

Why would you want to use a shared xl file for a db, if you need it to store and retrieve data use xml which is much more accessible, better in performance and compatible in computers that doesn't have office installed (unless there are other purposes).

Anyway, this is not a problem, take a look here: http://support.microsoft.com/default.aspx/kb/295646

The document doesn't have to be readonly but as I remember from last time I used it, it will get stuck if you open the file.

Shimmy