Dappervar dsn = "Server=server01;Port=5432;User Id=taro;Password=123;Database=mydb"; using (var cn = new NpgsqlConnection(dsn)) { cn.Open(); var all = cn.Query(@"SELECT * FROM t2"); foreach (var row in all) { Console.WriteLine("ID:{0}, TM:{1}", row.id, row.tm.ToString("yyyy-mm-ddTHH:mm:ss")); } } Console.ReadLine(); 参考 |
|