コード例 #1
0
        //this button deletes a row from all tables
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            string deleteValue = textBoxSearch.Text.ToString();
            string query;

            query = string.Format("delete from salaries where workerid like {0}", deleteValue);
            CreateCommand(query, connectionString);

            query = string.Format("delete from positions where workerid like {0}", deleteValue);
            CreateCommand(query, connectionString);

            query = string.Format("delete from workers where workerid like {0}", deleteValue);
            CreateCommand(query, connectionString);


            MessageBox.Show("Worker has been removed!");
            Hide();
            WorkerForm newform = new WorkerForm();

            newform.ShowDialog(this);
        }
        private void BtnSave_Click(object sender, EventArgs e)
        {
            string query = string.Format("insert into workers values ({0},'{1}')", workeridTextBox.Text, workernameTextBox.Text);

            CreateCommand(query, connectionString);

            query = string.Format("insert into salaries values ({0},'{1}')", workeridTextBox.Text, salaryTextBox.Text);
            CreateCommand(query, connectionString);

            query = string.Format("insert into positions values ({0},'{1}')", workeridTextBox.Text, positionTextBox.Text);
            CreateCommand(query, connectionString);

            MessageBox.Show("Worker added!");
            //this.Close();

            Application.OpenForms["WorkerForm"].Hide();
            Application.OpenForms["WorkerAddForm"].Hide();
            Application.OpenForms["WorkerAddForm"].Close();
            WorkerForm newform = new WorkerForm();

            newform.ShowDialog(this);
        }
コード例 #3
0
        private void BtnWorkers_Click(object sender, EventArgs e)
        {
            WorkerForm newform = new WorkerForm();

            newform.ShowDialog(this);
        }