private void ChangeBtn1_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { MessageBox.Show("请选择一行"); return; } Intent.State = "CHANGE"; BusEdit be = new BusEdit(); Bus b = new Bus(); b.SetValue( listView1.SelectedItems[0].SubItems[0].Text, listView1.SelectedItems[0].SubItems[1].Text ); be.b = b; Intent.OLD_ID = b.BNo; if (be.ShowDialog() == DialogResult.OK) { sql = @"" + " UPDATE [Buses]" + " SET" + " [BNo]='" + be.b.BNo + "'," + " [Producer]='" + be.b.Producer + "'" + " WHERE [BNo]='" + Intent.OLD_ID + "'"; db.SetBySQL(sql); UpdateListView(); } }
/* Tab1所有功能 */ private void AddBtn1_Click(object sender, EventArgs e) { Intent.State = "ADD"; BusEdit be = new BusEdit(); if (be.ShowDialog() == DialogResult.OK) { sql = @"" + " INSERT INTO [Buses]" + " VALUES" + " (" + " '" + be.b.BNo + "'," + " '" + be.b.Producer + "'" + " )"; db.SetBySQL(sql); UpdateListView(); } }