Added ErrorMessage method to Database

Also: fixed statement execution, a defect introduced in the migration to
prepared statements.