//连接数据
private static string conStr = "Host=localhost;Port=5432;Username=postgres;Password=admin;Database=postgres";
//插入操作
string insertStr = $"INSERT INTO tb_test(id,name) VALUES(@id,@name)";
NpgsqlCommand cmd = new NpgsqlCommand(insertStr, conn);
cmd.Parameters.AddWithValue("@id", 14);
cmd.Parameters.AddWithValue("@name", "Jack");
cmd.ExecuteNonQuery();