Esempio n. 1
0
        /* Tab3所有功能 */
        private void AddBtn3_Click(object sender, EventArgs e)
        {
            Intent.State = "ADD";
            BuslineEdit ble = new BuslineEdit();

            if (ble.ShowDialog() == DialogResult.OK)
            {
                sql = @"" +
                      " INSERT INTO [Buslines]" +
                      " VALUES" +
                      " (" +
                      "   " + ble.bl.BlNo + "," +
                      "   '" + ble.bl.Start + "'," +
                      "   '" + ble.bl.End + "'," +
                      "   " + ble.bl.Distance + "" +
                      " )";
                db.SetBySQL(sql);

                UpdateListView();
            }
        }
Esempio n. 2
0
        private void ChangeBtn3_Click(object sender, EventArgs e)
        {
            if (listView3.SelectedItems.Count == 0)
            {
                MessageBox.Show("请选择一行");
                return;
            }

            Intent.State = "CHANGE";
            BuslineEdit ble = new BuslineEdit();
            Busline     bl  = new Busline();

            bl.SetValue(
                listView3.SelectedItems[0].SubItems[0].Text,
                listView3.SelectedItems[0].SubItems[1].Text,
                listView3.SelectedItems[0].SubItems[2].Text,
                listView3.SelectedItems[0].SubItems[3].Text
                );
            ble.bl        = bl;
            Intent.OLD_ID = bl.BlNo;

            if (ble.ShowDialog() == DialogResult.OK)
            {
                sql = @"" +
                      " UPDATE [Buslines]" +
                      " SET" +
                      "   [BlNo]=" + ble.bl.BlNo + "," +
                      "   [Start]='" + ble.bl.Start + "'," +
                      "   [End]='" + ble.bl.End + "'," +
                      "   [Distance]=" + ble.bl.Distance + "" +
                      " WHERE [BlNo]=" + Intent.OLD_ID + "";
                db.SetBySQL(sql);

                UpdateListView();
            }
        }