Exemple #1
0
        private void Button_addCard_Click(object sender, EventArgs e)
        {
            CardData data = GetCard();
            string   sql  = CDB.GetInsertSQL(data);

            if (CDB.Command(CDBfile, sql) < 2)
            {
                MessageBox.Show("添加失败!\n卡片已经存在!", "错误");
            }
            else
            {
                SQL.Append("delete from datas where id=");
                SQL.Append(data.code.ToString());
                SQL.Append(";delete from texts where id=");
                SQL.Append(data.code.ToString());
                SQL.Append(";");
                ReadData();
            }
        }
Exemple #2
0
        private void Button_delCard_Click(object sender, EventArgs e)
        {
            int           Pid  = 0;
            StringBuilder dsql = new StringBuilder();

            ListView.SelectedIndexCollection c = listView_Cards.SelectedIndices;
            if (c.Count > 0)
            {
                for (int i = 0; i < c.Count; i++)
                {
                    if (int.TryParse(listView_Cards.Items[c[i]].SubItems[0].Text, out Pid))
                    {
                        dsql.Append("delete from datas where id=");
                        dsql.Append(Pid.ToString());
                        dsql.Append(";delete from texts where id=");
                        dsql.Append(Pid.ToString()); dsql.Append(";");
                        SQL.Append(CDB.GetInsertSQL(CDB.cards[Pid]));
                    }
                }
                CDB.Command(CDBfile, dsql.ToString());
                dsql = null;
                ReadData();
            }
        }