DBGrid数据删除
//这是插入的
void __fastcall TForm1::btnenteringClick(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("insert into personal_information values('"+edtname->Text+"','"+edtnation->Text+ \
"','"+sex+"','"+age+"','"+birthdate+"','"+edtid->Text+"','"+np+"')\
select Name,Nation,Sex,Age,CONVERT(varchar(10),Birthdate,20),IDcard,NP from personal_information");
ADOQuery1->Open();
}
//这是删除多行的
void __fastcall TForm1::btndeleteClick(TObject *Sender)
{
for(int i=0;i<DBGrid1->SelectedRows->Count;i++)
{
DBGrid1->DataSource->DataSet->GotoBookmark((void *)DBGrid1->SelectedRows->Items[i].c_str());
DBGrid1->DataSource->DataSet->Delete();
}
}