通过odbc,c#连接pg数据库
- 作者:xiaoxiao
- 发表时间:2020-12-23 10:36
- 来源:未知
通过odbc,c#连接pg数据库using System;
namespace Test{ class mainClass { static void Main() { System.Data.Odbc.OdbcConnection conn=new System.Data.Odbc.OdbcConnection(); System.Data.Odbc.OdbcCommand cmd=new System.Data.Odbc.OdbcCommand(); conn.ConnectionString="Driver={PostgreSQL};Server=192.168.0.1;Database=test;Username=test;Password=test;"; try { conn.Open(); Console.WriteLine("{0}",conn.State); } catch (Exception ee) { Console.WriteLine(ee.Message); } } }}
ps:pg odbc的下载地址:http://laser.free-bsd.org/download/psqlodbc-07_03_0200.zip