I work with PostgreSQL 9.2 at Windows 7 x86. In attempt to receive DataSourceInformation through ADO.NET OLE DB PGNP provider I receive System.InvalidCastException exception.
Code on C#:
- Code: Select all
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = "Provider=PGNP.1;Password=REACT;Persist Security Info=True;User ID=postgres;Initial Catalog=InternetDB;Data Source=localhost;Extended Properties=\"SSL=allow;\"";
connection.Open();
DataTable table = connection.GetSchema("DataSourceInformation");
connection.Close();
Generates an exception:
- Code: Select all
System.InvalidCastException: Specified cast is not valid.
at System.Data.OleDb.OleDbMetaDataFactory.GetDataSourceInformationTable(OleDbConnection connection, OleDbConnectionInternal internalConnection)
at System.Data.OleDb.OleDbMetaDataFactory.PrepareCollection(String collection
Name, String[] restrictions, DbConnection connection)
at System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)
at System.Data.ProviderBase.DbConnectionInternal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)
at System.Data.OleDb.OleDbConnection.GetSchema(String collectionName, String[] restrictionValues)
at System.Data.OleDb.OleDbConnection.GetSchema(String collectionName)
at ConsoleApplication1.Program.Main(String[] args)
Provider PGNP-Postgres-SE-Trial-1.4.0.3076.exe (trial)
Anyone knows how to fix it?
Thanks.
