From the Internet, we can see that. NET operates on PostgreSQL. Article
Http://www.zdnet.com.cn/developer/code/story/0,3800066897,39530081-1,00.htm)
According to his example, it is wrong, mainly because of some details, which he did not mention.
You need to add two DLL files: Mono. Security. dll and npgsql. dll.
Here is an example for your reference: 1 Private Void Button#click ( Object Sender, system. eventargs E)
2 {
3 Richtextbox1.text = String . Format (
4 " Server = {0}; Port = {1}; userid = {2}; database = testdb; Password = {3}; Protocol = 3; SSL = false; pooling = true; minpoolsize = 1; maxpoolsize = 20; encoding = Unicode; timeout = 60; sslmode = Disable " ,
5 Textbox1.text. Trim (), textbox2.text. Trim (), textbox3.text. Trim (), textbox4.text. Trim ());
6
7 Npgsqlconnection Conn = New Npgsqlconnection ();
8 Conn. connectionstring = Richtextbox1.text;
9
10 Npgsqlcommand comm = New Npgsqlcommand ();
11 Comm. Connection = Conn;
12 Conn. open ();
13 Comm. commandtext = @" Select * From datas; " ;
14 Dataset DS = New Dataset ();
15 Npgsqldataadapter SDA = New Npgsqldataadapter ();
16 SDA. selectcommand = Comm;
17 SDA. Fill (DS, " Datas " );
18 If (Ds. Tables [ 0 ]. Rows. Count ! = 0 )
19 {
20 Datagrid1.datasource = DS. Tables [ " Datas " ];
21 MessageBox. Show ( " OK " );
22 }
23 Conn. Close ();
24 }
PostgreSQL driverProgramIs:
Http://pgfoundry.org/frs? Group_id = 1000140