public void InsertRow(string pgConnectionString)
{
// If the connection string is empty, use default.
if(pgConnectionString == "")
{
pgConnectionString =
"host=server;database=test;user id=postgres;";
}
PgSqlConnection myConn = new PgSqlConnection(pgConnectionString);
string myInsertQuery = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')";
PgSqlCommand pgCommand = new PgSqlCommand(myInsertQuery);
pgCommand.Connection = myConn;
myConn.Open();
try
{
pgCommand.ExecuteNonQuery();
}
finally
{
myConn.Close();
}
}