Ejemplo n.º 1
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            Intent.dict["FLAG"] = "ADD";

            Form2 form2 = new Form2();

            if (form2.ShowDialog() == DialogResult.OK)
            {
                // 更新数据库
                String EmpNo   = Intent.dict["EmpNo"].ToString();
                String EmpName = Intent.dict["EmpName"].ToString();
                String EmpSex  = Intent.dict["EmpSex"].ToString();
                String EmpAge  = Intent.dict["EmpAge"].ToString();

                sqlString = @"" +
                            " INSERT INTO [EMPLOYEE] VALUES (" +
                            " '" + EmpNo + "'," +
                            " '" + EmpName + "'," +
                            " '" + EmpSex + "'," +
                            " " + EmpAge + "" +
                            ")";
                db.SetBySQL(sqlString);

                // 更新显示
                LoadMainTab();
            }
            listView1.SelectedItems.Clear();
        }