[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

ODBC Connection in Windows Service

Josh Corn

8/9/2002 10:09:00 PM

Hi,
I'm trying to make an ODBC connection to a MS Access
database from a .NET Windows Service (NOT an ASP .NET
service) as follows:

try {
string db_name = "MyDSN";
public OdbcConnection db = new OdbcConnection
("DSN="+db_name);

db.Open();
}
catch (OdbcException e) {
error = e.Message;
}

An exception is thrown on the db.Open() call. This works
fine when called from a normal .NET Windows program, it
only doesn't work from a Windows Service. I have both
User DSN and System DSN setup in the ODBC DataSources.

When an exception is thrown, "e.Message" is an empty
string.

Any help would be much appreciated.

Josh