Re: PostgreSQL and C#

Поиск
Список
Период
Сортировка
От Matthew Stanfield
Тема Re: PostgreSQL and C#
Дата
Msg-id 3CB30D04.A6D086BD@propertyknowledge.com
обсуждение исходный текст
Ответ на PostgreSQL and C#  ("Daniel Morgan" <danmorg@sc.rr.com>)
Список pgsql-general
> I really want to use C# and .NET to query PostgreSQL 7.2 databases?

Hi Daniel,

The way I have done it is by using ODBC. You will need to download:
odbc.net from the microsoft site (URL below) and the postgresql odbc driver
(URL below).

Some of the .net CLR database orientated classes are specific to
Microsoft's SQL Server so you can't use them. odbc.net provides a suite of
classes such as OdbcConnection, OdbcCommand and OdbcDataReader; which, so
far, have been really easy to use (see mini example below).


> Do I need to get the source the PostgreSQL database itself?

Absolutely not! I highly recommend you using odbc.net to connect to
postgresql, it is simple to use (and learn), fast and has, so far, been bug
free.

postgresql odbc site:
http://odbc.postgresql.org

odbc.net is here (watch out for the line wrap)

http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/MSDN-FILES/027/001/668/msdncompositedoc.xml

Mini Example:

string query = "SELECT * FROM testtable";
OdbcConnection odbcCon = new OdbcConnection("DSN=PostgreSQL");
OdbcCommand odbcCom = new OdbcCommand(query, odbcCon);
odbcCon.Open();
OdbcDataReader odbcReader =
odbcCom.ExecuteReader(CommandBehavior.CloseConnection);
Then you can start 'reading'.

Good luck,

..matthew

В списке pgsql-general по дате отправления:

Предыдущее
От: Patrick Welche
Дата:
Сообщение: Re: numeric test on RiscPC
Следующее
От: "Papp, Gyozo"
Дата:
Сообщение: Re: SPI_execp() failed in RI_FKey_cascade_del()