Data source name not found and no default driver specified
I'm getting this error when trying to open the connection in code as follows:
string queryString = "Insert into Table;
OdbcConnection connection = new OdbcConnection();
connection.ConnectionString = Settings.Default.STIMConnectionString;
OdbcCommand command = new OdbcCommand(queryString,connection);
connection.Open();
command.ExecuteNonQuery();
My Appconfig is as follows:
<add name="WindowsFormsApplicationTransducer.Properties.Settings.STIMConnection"
connectionString="Provider=Microsoft.ACE.OLEDB.12.0; Data Source="D:\Development\SS Observer II Decoder.mdb"" />
What am i do开发者_运维技巧ing wrong?
Since you are using the OdbcConnection, I think you need to include the "Driver" information in your connection string.
Data Source is not a valid connection string property. ODBC originally used a data source name, or DSN=dsnname, where the DSN was configured separately on the system. However you can alternatively specify the driver and driver-specific parameters, which in the case of the Microsoft Access driver is at the minimum the file name: Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\Development\SS Observer II Decoder.mdb.
See http://connectionstrings.com/ to see what you need to have.
加载中,请稍侯......
精彩评论