simple oleDB problem

  • Thread starter Thread starter Mark Ogilvie
  • Start date Start date
M

Mark Ogilvie

Hi
I'm new to C#, and have a problem which I'm sure is simple.

I have the following 3 lines of code:

string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\tw97_data.mdb;Persist Security Info=False";

string SelectPartiesString = "SELECT parties.[party number],
clients.[Client number], clients.Name FROM clients LEFT JOIN parties ON
clients.[Client number] = parties.[client number]";

OleDbDataAdapter TWSalesDBAdapter = new
OleDbDataAdapter(ConnectionString, SelectPartiesString);

When run, I get the following error, with respect to the connection string:
"An OLE DB Provider was not specified in the ConnectionString. An
example would be, 'Provider=SQLOLEDB;"

I don't presume to disagree with the compiler, but the connection string
I'm using looks to me like an OLEDB provider string. Obviously I have
mis-understood something, or done something wrong? Can someone tell me
what it is? Many thanks in advance...

cheers
mark O.
 
Try the following syntax:

"Data Source=\"C:\tw97_data.mdb\";Provider=\"Microsoft.Jet.OLEDB.4.0\";Jet
OLEDB:Engine Type=5;"

You have not specified, which MS Access version you are using, I am giving
you the Connection String for MS Access 4.0 and below.
If it is above, then you just need to change the Type parameter.

Good Luck !!!
 
Back
Top