string connectionString = "Dsn=PostgreSQL35W3;uid=postgres;pwd=postgres";
OdbcConnection myConn
= new OdbcConnection
(connectionString
); string sql = "select id_cabanha from mirage.cabanha where id_estado=2";
OdbcCommand myCommand
= new OdbcCommand
(sql, myConn
); myConn.Open();
OdbcDataReader select = myCommand.ExecuteReader();
while (select.Read())
{
for (int i = 0; (i < (select.FieldCount)); i++)
{
MessageBox.Show("BT_" + Convert.ToString(select.GetValue(i)));
this.Controls["BT_" + Convert.ToString(select.GetValue(i))].BackColor = Color.Green;
}
}
myCommand.Connection.Close();
myConn.Close();