Example #1
0
 public bool executeInsert(ExecutableQuery query)
 {
     NpgsqlCommand command = new NpgsqlCommand(query.getQuery(), conn);
     int status = 0;
     bool result = false;
     try
     {
         status = command.ExecuteNonQuery();
     }
     catch (NpgsqlException e)
     {
         MessageBox.Show("Błąd: " + e.BaseMessage + "\n\n" + query.getQuery(), "ErrorMessage");
     }
     finally
     {
         result = (status > 0);
     }
     return result;
 }
Example #2
0
 public NpgsqlDataReader executeQuery(ExecutableQuery query)
 {
     NpgsqlCommand command = new NpgsqlCommand(query.getQuery(), conn);
     NpgsqlDataReader dr = null;
     try
     {
         dr = command.ExecuteReader();
     }
     catch (NpgsqlException e)
     {
         //MessageBox.Show("Błąd: " + e.BaseMessage + "\n\n" + query.getQuery(), "ErrorMessage");
         MessageBox.Show("Niepoprawne dane.");
     }
     return dr;
 }