private void button2_Click(object sender, EventArgs e) { int selrow; try { selrow = dataGridView1.SelectedCells[0].RowIndex; } catch (Exception) { MessageBox.Show("没有选择任何行!", "错误"); return; } if (MessageBox.Show("确认要删除该会员?", "删除会员", MessageBoxButtons.OKCancel) == DialogResult.OK) { Mysqlcom my = new Mysqlcom(); if (!my.conn) { MessageBox.Show("数据库连接失败:" + my.error); return; } if (my.enq("delete from wa_vip where VID="+dataGridView1.Rows[selrow].Cells[0].Value ) == -1) { MessageBox.Show("会员删除失败:" + my.error); return; } ds.Tables["wa_wash"].Rows.RemoveAt(selrow); } }
private void button3_Click(object sender, EventArgs e) { int selrow; try { selrow = dataGridView1.SelectedCells[0].RowIndex; } catch (Exception) { MessageBox.Show("没有选择任何行!", "错误"); return; } Mysqlcom my = new Mysqlcom(); if (!my.conn) { MessageBox.Show("数据库连接失败:" + my.error); return; } if (my.enq("update wa_vip set vipid='" + dataGridView1.Rows[selrow].Cells[2].Value + "',Telphone='" + dataGridView1.Rows[selrow].Cells[3].Value + "',ShenFenHao='" + dataGridView1.Rows[selrow].Cells[4].Value + "',ChunKuan='" + dataGridView1.Rows[selrow].Cells[5].Value + "',XianJin='" + dataGridView1.Rows[selrow].Cells[6].Value + "',XaoFei='" + dataGridView1.Rows[selrow].Cells[7].Value + "',credate='" + dataGridView1.Rows[selrow].Cells[8].Value + "',discount='" + dataGridView1.Rows[selrow].Cells[9].Value + "',JiFen='" + dataGridView1.Rows[selrow].Cells[10].Value + "',mark='" + dataGridView1.Rows[selrow].Cells[11].Value + "',state='" + dataGridView1.Rows[selrow].Cells[12].Value + "',fromID='" + dataGridView1.Rows[selrow].Cells[13].Value + "' where VID=" + dataGridView1.Rows[selrow].Cells[0].Value) == -1) { MessageBox.Show("会员修改失败:" + my.error); return; } MessageBox.Show("修改成功!"); }
private void button3_Click(object sender, EventArgs e) { int selrow; try { selrow = dataGridView1.SelectedCells[0].RowIndex; } catch (Exception) { MessageBox.Show("没有选择任何行!", "错误"); return; } Mysqlcom my = new Mysqlcom(); if (!my.conn) { MessageBox.Show("数据库连接失败:" + my.error); return; } if (my.enq("update wa_login set password='******',team='" + dataGridView1.Rows[selrow].Cells[3].Value + "',logdate='" + dataGridView1.Rows[selrow].Cells[4].Value + "',loginIP='" + dataGridView1.Rows[selrow].Cells[5].Value + "' where UID=" + dataGridView1.Rows[selrow].Cells[0].Value) == -1) { MessageBox.Show("工号修改失败:" + my.error); return; } MessageBox.Show("修改成功!"); }