Reputation: 16979
This is my old code.
conn = new System.Data.Odbc.OdbcConnection();
conn.ConnectionString = @"DSN=dBase Files";
It throws an Error: (I think my old code might still work on 32 bit machines, but I am on 64 now)
"[Error] [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified"
All my searches told me to use SysWow64/odbcad32.exe to create a .DSN file. Now I created the DSN file, How can I modify this line, conn.ConnectionString = @"DSN=dBase Files";
, to point to the .DSN file I saved on disk?
Upvotes: 1
Views: 8449
Reputation: 3987
As far as I recall, I had to set up the DSN in ODBC Data Sources under Administrative Tools, but that was around the turn of the century.
This might help: FILEDSN=c:\myDsnFile.dsn;Uid=myUsername;Pwd=;
So something like:
conn = new System.Data.Odbc.OdbcConnection();
conn.ConnectionString = @"FILEDSN=C:\path\to\dsn\file\here.dsn;Uid=myUsername;Pwd=;";
From here.
Upvotes: 4