Thanks. Problem solved following:
dim strpg as string = "Dsn=PostgreSQL;Provider=SQLOLEDB;"
Dim connection As OdbcConnection = New OdbcConnection(strpg)
connection.Open()
Dim fullCommandText As String = "select * from table1"
Dim select_command As New OdbcCommand(fullCommandText, connection)
etc.
> I think your connectionstring is wrong. "Provider=SQLOLEDB;" is for SQL
> Server, not for PostGresSQL. Depending what Data Provider you have installed
[quoted text clipped - 28 lines]
> >
> > Suggestions appreciated - thanks.
>> > I've been trying to connect to a postgressql database using oledb.
>> >
[quoted text clipped - 15 lines]
>>
>> http://www.connectionstrings.com/?carrier=postgressql
> Thanks. Problem solved following:
> dim strpg as string = "Dsn=PostgreSQL;Provider=SQLOLEDB;"
[quoted text clipped - 4 lines]
> connection)
> etc.
Yes, but you've resorted to using ODBC when there's a perfectly serviceable
OleDb provider available - that is (almost always) the wrong solution...
Because you've specified a DSN, the Provider element is simply being
ignored.
As you've been advised, Provider=SQLOLEDB is for SQL Server, not Postgre.
For Postgre, the Provider is PostgreSQL OLE DB Provider:
In fact, there's a native .NET data provider for Postgre which I would
strongly advise you to use instead:
http://www.connectionstrings.com/?carrier=postgresql

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
segue - 07 Mar 2008 22:30 GMT
OK thank you for the heads up this solved another problem as well.
> >> > I've been trying to connect to a postgressql database using oledb.
> >> >
[quoted text clipped - 37 lines]
> strongly advise you to use instead:
> http://www.connectionstrings.com/?carrier=postgresql
I agree with Mark.
> Thanks. Problem solved following:
> dim strpg as string = "Dsn=PostgreSQL;Provider=SQLOLEDB;"
[quoted text clipped - 39 lines]
>> >
>> > Suggestions appreciated - thanks.