예제 #1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (comboBox2.Text == "")
            {
                MessageBox.Show("Category不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (comboBox3.Text == "")
            {
                MessageBox.Show("Item不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (richTextBox3.Text == "")
            {
                MessageBox.Show("内容不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sql  = "update Data set Content = '" + richTextBox3.Text + "' where Category = '" + comboBox2.Text + "' and Item = '" + comboBox3.Text + "'";
            int    flag = SqliteDB.ExecuteNonQuery(sql);

            if (flag == 1)
            {
                Log.ActionLog("修改一条记录:" + sql);
                MessageBox.Show("修改成功", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("修改失败,详情请查看日志文件", "Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (comboBox2.Text == "")
            {
                MessageBox.Show("Category不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (comboBox3.Text == "")
            {
                MessageBox.Show("Item不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sql  = "delete from Data where Category = '" + comboBox2.Text + "' and Item = '" + comboBox3.Text + "'";
            int    flag = SqliteDB.ExecuteNonQuery(sql);

            if (flag == 1)
            {
                Log.ActionLog("删除一条记录:" + sql);
                MessageBox.Show("删除成功", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("删除失败,详情请查看日志文件", "Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "")
            {
                MessageBox.Show("Category不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (textBox1.Text == "")
            {
                MessageBox.Show("Item不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (richTextBox2.Text == "")
            {
                MessageBox.Show("内容不可为空!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            string sql  = "insert into Data values ('" + comboBox1.Text + "','" + textBox1.Text + "','" + richTextBox2.Text + "')";
            int    flag = SqliteDB.ExecuteNonQuery(sql);

            if (flag == 1)
            {
                Log.ActionLog("插入一条记录:" + sql);
                MessageBox.Show("增加成功", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("增加失败,详情请查看日志文件", "Note", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }