Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var a = new AddEquip();

            //a.Show();
            a.ShowDialog();
            if (a.DialogResult == DialogResult.OK)
            {
                refresh("select items.id, items.name, category.description,items.status from items left join category on category.id = items.categoryID");
                setCount("Select COUNT(*) as test from items ");
            }
        }
Esempio n. 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (counter != "0")
     {
         DialogResult dg = MessageBox.Show("Are you sure?", "Alert!", MessageBoxButtons.YesNo);
         if (dg == DialogResult.Yes)
         {
             string insertQuery1 = "INSERT INTO archiveditems(itemID, name, category) VALUES (" + dgv.Rows[dgv.SelectedRows[0].Index].Cells[0].Value.ToString() + ",'" + dgv.Rows[dgv.SelectedRows[0].Index].Cells[1].Value.ToString() + "','" + dgv.Rows[dgv.SelectedRows[0].Index].Cells[2].Value.ToString() + "')";
             executeMyQuery(insertQuery1);
             string insertQuery = "DELETE FROM items WHERE id =" + dgv.Rows[dgv.SelectedRows[0].Index].Cells[0].Value.ToString();
             executeMyQuery(insertQuery);
             refresh("select items.id, items.name, category.description,items.status from items left join category on category.id = items.categoryID");
             setCount("Select COUNT(*) as test from items ");
             var a = new AddEquip();
             a.setCount("SELECT id+1 AS next_id FROM items ORDER BY id DESC LIMIT 1");
             MessageBox.Show("Deleted");
         }
     }
     else
     {
         MessageBox.Show("Table is empty.", "Error. ",
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }