I have a C# MDI application developed under VS2012 that works fine. I am trying to hook into a database and having problems. I have connected into the same database from 3 other apps, but they are 'standard' windows apps in C++, but also in VS2012. I get back a connect string from SQLDriverConnect which works fine in C++ but it and a zillion other strings from code samples get internal errors in C# on my OleDbConnection call. (Note: I only run the applications one at a time).
The application is tabbed MDI, NET framework 4 windows app.
Code:
String strAccessConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\L drive\\PI Database\\Private_I.accdb;Persist Security Info=True;";
OleDbConnection myAccessConn = null;
try
{
myAccessConn = new OleDbConnection(strAccessConn);
}
The error is:
'myAccessConn.ServerVersion' threw an exception of type 'System.InvalidOperationException'
The same happens when I change to:
String strAccessConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\L drive\PI Database\Private_I.accdb;Persist Security Info=True;";
It is a forms application, and I connect to the database when opening first child form.
ert304