zoukankan      html  css  js  c++  java
  • C#操作PostgreSQL9.2

    C#操作PostgreSQL


    先去下个PostgreSql.Data.PostgreSqlClient.dll的文件.(如果网上不好下,那去下个SharpMap,SharpMap.Extensions这个文件夹里面有)

    然后添加引用,使用命名空间

    using PostgreSql.Data.PostgreSqlClient;

    然后
              string connectString = @"Server=localhost;Database=test;UserID=test;Password=test";

                PgConnection conn = new PgConnection(connectString);

                conn.Open();

                PgCommand cmd = conn.CreateCommand();

                cmd.CommandText = "select * from \"test\"";

                cmd.CommandType = CommandType.Text;

                using (PgDataReader reader = cmd.ExecuteReader())

                {

                    while (reader.Read())

                                            this.richTextBox1.Text += reader[0].ToString()+"\n";

                }

  • 相关阅读:
    docx python
    haozip 命令行解压文件
    python 升级2.7版本到3.7
    Pyautogui
    python 库搜索技巧
    sqlserver学习笔记
    vim使用
    三极管工作原理分析
    串口扩展方案+简单自制电平转换电路
    功率二极管使用注意
  • 原文地址:https://www.cnblogs.com/dview112/p/2736832.html
Copyright © 2011-2022 走看看