views:

240

answers:

1

At the moment I'm searching for properties for a connection string, which can be used to connect to an Excel file in readonly mode. Searching Google gets me a lot of examples of connection strings, but I can't seem to find a specification of all possibilities in the 'Extended Properties' section of the OleDb connection string.

At the moment I've this:

Provider = Microsoft.Jet.OLEDB.4.0; Data Source = D:\Data\Customers.xls; Extended Properties = 'Excel 8.0; Mode=Read; ReadOnly=true; HDR=Yes';

However... I've composed this by examples. So questions: 1. What is a decent source for OleDb Connection String documentation/reference? 2. Is the above connection string indeed connecting to the Excel file in readonly mode?

Thanks!

+1  A: 

I am using UDL file for that.

Do next:

  1. create empty file test.udl
  2. open it
  3. You will see Data Link Properties dialog
  4. On first tab change provider to Microsoft.Jet.OLEDB.4.0;
  5. Second tab select you Excel file
  6. Third tab set permission like Read
  7. On last tab set Extended Properties = 'Excel 8.0; HDR=Yes'

Than save, and open file in text editor and you will see connection string

As well you can check msdn article ADO Provider Properties and Settings

volody