Пример #1
0
        /* Tab4所有功能 */
        private void AddBtn4_Click(object sender, EventArgs e)
        {
            Intent.State = "ADD";
            TimetableEdit te = new TimetableEdit();

            if (te.ShowDialog() == DialogResult.OK)
            {
                sql = @"" +
                      " INSERT INTO [Timetable]" +
                      " VALUES" +
                      " (" +
                      "   " + te.tt.BlNo + "," +
                      "   '" + te.tt.DNo + "'," +
                      "   '" + te.tt.BNo + "'," +
                      "   '" + te.tt.FirstLaunch + "'" +
                      " )";
                db.SetBySQL(sql);

                UpdateListView();
            }
        }
Пример #2
0
        private void ChangeBtn4_Click(object sender, EventArgs e)
        {
            if (listView4.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择一行");
                return;
            }

            Intent.State = "CHANGE";
            TimetableEdit te = new TimetableEdit();
            Timetable     tt = new Timetable();

            tt.SetValue(
                listView4.SelectedItems[0].SubItems[0].Text,
                listView4.SelectedItems[0].SubItems[1].Text,
                listView4.SelectedItems[0].SubItems[2].Text,
                listView4.SelectedItems[0].SubItems[3].Text
                );
            te.tt         = tt;
            Intent.OLD_ID = tt.BlNo;

            if (te.ShowDialog() == DialogResult.OK)
            {
                sql = @"" +
                      " UPDATE [Timetable]" +
                      " SET" +
                      "   [BlNo]=" + te.tt.BlNo + "," +
                      "   [DNo]='" + te.tt.DNo + "'," +
                      "   [BNo]='" + te.tt.BNo + "'," +
                      "   [FirstLaunch]='" + te.tt.FirstLaunch + "'" +
                      " WHERE [BlNo]=" + Intent.OLD_ID + "";
                db.SetBySQL(sql);

                UpdateListView();
            }
        }