From: | rey4(at)columbia(dot)edu (Russell Yanofsky) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Can PostgreSQL be used with ASP or .NET? |
Date: | 2002-02-16 23:01:43 |
Message-ID: | 7371185c.0202161501.6f6458da@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> can you tell us how do you create the database object?
Here's an example of using postgres in C#. "site" is a system DSN that
is set up with a username and password.
using Microsoft.Data.Odbc;
...
OdbcConnection postgres;
postgres = new OdbcConnection("DSN=site");
postgres.Open();
OdbcCommand cmd = new OdbcCommand("SELECT language_id, name FROM
languages");
cmd.Connection = postgres;
OdbcDataReader reader = cmd.ExecuteReader();
while(reader.Read())
Response.Write("<option value=" + reader.GetInt32(0) + ">"
+ reader.GetString(1) + "</option>\n");
reader.Close();
postgres.Close();
postgres = null;
To use ODBC in .NET you need the "ODBC .NET Data Provider" available
at
http://msdn.microsoft.com/downloads/sample.asp?url=/msdn-files/027/001/668/msdncompositedoc.xml
From | Date | Subject | |
---|---|---|---|
Next Message | Done | 2002-02-16 23:21:30 | What about libpq-fe.h ? |
Previous Message | Roberto Andrade Fonseca | 2002-02-16 21:05:01 | Help with a plpgsql function |