Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Connector      databaseConnect = new MYSQLDatabaseConnection();
            DatabaseColumn databaseColumn  = new DatabaseColumn();

            databaseColumn.category_name = txtCategoryName.Text.ToString();
            databaseColumn.category_id   = txtCategoryId.Text.ToString();

            databaseConnect.SetData(databaseColumn);



            if (databaseConnect.establish() == true && databaseConnect.InsertCategoryDetails() == true)
            {
                var list = new List <DatabaseColumn>()
                {
                    new DatabaseColumn {
                        category_name = txtCategoryName.Text.ToString(), category_id = txtCategoryId.Text.ToString()
                    }
                };
                CombineDataGridView combineDataGridView = new CombineDataGridView();
                combineDataGridView.SetDataGridViewList(list, mDgv);//connect main window datagridview

                txtCategoryId.Clear();
                txtCategoryName.Clear();
            }
            else
            {
                MessageBox.Show("operation error");
            }
        }