private void cargararray(string nomtabla)
        {
            int c = 0;

            bd.leertabla(nomtabla);
            while (bd.Reader.Read())
            {
                Consortiumcls cons = new Consortiumcls();
                if (!bd.Reader.IsDBNull(0))
                {
                    cons.Idconsortium = bd.Reader.GetInt32(0);
                }
                if (!bd.Reader.IsDBNull(1))
                {
                    cons.Name = bd.Reader.GetString(1);
                }
                if (!bd.Reader.IsDBNull(2))
                {
                    cons.Cuit = bd.Reader.GetDouble(2);
                }
                if (!bd.Reader.IsDBNull(3))
                {
                    cons.Address = bd.Reader.GetString(3);
                }
                if (!bd.Reader.IsDBNull(4))
                {
                    cons.Number = bd.Reader.GetInt32(4);
                }
                if (!bd.Reader.IsDBNull(5))
                {
                    cons.District = bd.Reader.GetString(5);
                }
                arraycons[c] = cons;
                c++;
            }
            bd.Reader.Close();
            bd.desconectar();
            listBox1.Items.Clear();
            for (int i = 0; i < c; i++)
            {
                listBox1.Items.Add(arraycons[i].Name);
            }
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Consortiumcls p = new Consortiumcls();

            p.Name     = txtNombre.Text;
            p.Cuit     = Convert.ToDouble(txtCuit.Text);
            p.District = txtBarrio.Text;
            p.Address  = txtDireccion.Text;
            p.Number   = Convert.ToInt32(txtNumero.Text);

            if (nuevo == true)
            {
                string consultasql = "insert into consorcio(cuit,nombre,direccion,numero,barrio) " +
                                     "values (" + p.Cuit +
                                     ",'" + p.Name +
                                     "','" + p.Address +
                                     "'," + p.Number +
                                     ",'" + p.District +
                                     "')";
                bd.modificarbd(consultasql);
                cargarcombo(cmbConsorcio, "consorcio");
                cargararray("consorcio");
                limpiar();
            }
            else
            {
                p.Idconsortium = arraycons[listBox1.SelectedIndex].Idconsortium;
                string consultasql = "update consorcio set " +
                                     "nombre= '" + p.Name + "'," +
                                     "cuit= " + p.Cuit + "," +
                                     "direccion= '" + p.Address + "'," +
                                     "numero= " + p.Number + "," +
                                     "barrio= '" + p.District + "' " +
                                     "where id_consorcio= " + p.Idconsortium;
                bd.modificarbd(consultasql);
                cargarcombo(cmbConsorcio, "consorcio");
                cargararray("consorcio");
                limpiar();
            }
        }