Now I have managed to create a DSN for NotesSQL 3.02i. Anybody can provide me with a snippet of C# sample codes to connect to the DSN?
Subject: Give me a snippet of C# sample codes to connect to a NotesSQL DSN
using System.Data.Odbc;
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();
DbReader.Close();
DbCommand.Dispose();
DbConnection.Close();
Refer: C# ADO.NET ODBC tutorial
Regards
Litty Joseph
Subject: RE: Give me a snippet of C# sample codes to connect to a NotesSQL DSN
Hi, Litty Joseph,
Now I use your codes, but encounter with the following exception:
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()