A strange exception encountered when establishing a connection to a DSN

I tried to run the following C# codes:

========================================

OdbcConnection DbConnection = new OdbcConnection(“DSN=SAMPLE_ISAM”);

DbConnection.Open();

OdbcCommand DbCommand = DbConnection.CreateCommand();

DbCommand.CommandText = “SELECT * FROM NATION”;

OdbcDataReader DbReader = DbCommand.ExecuteReader();

int fCount = DbReader.FieldCount;

Console.Write(“:”);

for ( int i = 0; i < fCount; i ++ )

{

String fName = DbReader.GetName(i);

Console.Write( fName + “:”);

}

Console.WriteLine();

========================================

but ended up the exception as below:

========================================

The exception is System.Data.Odbc.OdbcException: ERROR [S1000] [Lotus][ODBC Lotu

s Notes]You are not authorized to perform that operation

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver’s SQLSetConnectAttr failed

ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn’t support the ve

rsion of ODBC behavior that the application requested (see SQLSetEnvAttr).

at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode r

etcode)

at System.Data.Odbc.OdbcConnectionHandle…ctor(OdbcConnection connection, Odb

cConnectionString constr, OdbcEnvironmentHandle environmentHandle)

at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOption

s options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection own

ingObject)

at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbC

onnection owningConnection, DbConnectionPoolGroup poolGroup)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection ow

ningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection ou

terConnection, DbConnectionFactory connectionFactory)

at System.Data.Odbc.OdbcConnection.Open()

at conn_db.Main()

========================================

Who can provide any solutions?

Subject: RE: A strange exception encountered when establishing a connection to a DSN

I have tried as your instructions, but the exception is still there.

Subject: A strange exception encountered when establishing a connection to a DSN

Did you pass user id and password?

Try like this. Pass the user id/password of the effective Notes user, ie, the one mentioned in notes.ini file.

OdbcConnection DbConnection = new OdbcConnection(“DSN=SAMPLE_ISAM;UID=myname;PWD=Secret”)

Refer:

http://msdn2.microsoft.com/en-us/library/ms974403.aspx

Regards

Litty Joseph

Subject: RE: A strange exception encountered when establishing a connection to a DSN

Hi, Litty Joseph,

I have tried as you have instructed, but the exception was still there.

Moon River