private void Button_moCard_Click(object sender, EventArgs e) { string sql1, sql2; int id; ListView.SelectedIndexCollection c = listView_Cards.SelectedIndices; if (c.Count > 0) { if (int.TryParse(listView_Cards.Items[c[0]].SubItems[0].Text, out id)) { sql1 = CDB.GetUpdataSQL(CDB.cards[id]); SQL.Append(sql1); sql2 = CDB.GetUpdataSQL(GetCard()); //MessageBox.Show(sql[0]+"\n"+sql[1]); if (CDB.Command(CDBfile, sql2) < 2) { MessageBox.Show("修改失败!\n如果修改密码,请先添加再删除。", "错误"); } else { ReadData(); } } } }