Пример #1
0
        private void BtnDbSave_Click(object sender, EventArgs e)
        {
            /*INI READ AND SAVE CONNECTION PARAMETERS*/
            conParams.Hostaname = textHost.Text;
            conParams.User      = textUser.Text;
            conParams.Password  = textPass.Text;
            conParams.Dbname    = textDb.Text;
            /*END READ AND SAVE CONNECTION PARAMETERS*/

            /*Save params values */
            conParams.SetValueOnFile();


            //Test BD CONNETION
            DbConnetion dbConn = new DbConnetion();

            /*Abre conexion para test*/
            dbConn.StartConn();

            if (dbConn.StartConn().State == System.Data.ConnectionState.Open)
            {
                MessageBox.Show("Test de conexión exitoso", "Test de conexión");
                this.Close();
            }
        }
Пример #2
0
        public void PopulateCboBox()
        {
            System.Data.DataTable data = new System.Data.DataTable();

            dbConn.StartConn();

            if (dbConn.StartConn().State == System.Data.ConnectionState.Open)
            {
                string query = "SELECT " +
                               " ItemID" +
                               " FROM LineItem " +
                               " Group by ItemID " +
                               " Order by ItemID ASC ";


                dbConn.Query(query).Fill(data);

                CboItemlist.DataSource    = data;
                CboItemlist.ValueMember   = "ItemID";
                CboItemlist.DisplayMember = "ItemID";
            }
        }