Y
yanzi_wy
Unregistered / Unconfirmed
GUEST, unregistred user!
在一个FORM中用QUERY查询的结果如何存到一个已经建好的表里去?
QUERY是动态查询,在BUTTON事件中调用,如下:
void __fastcall TfrmSearch::btnOKClick(TObject *Sender)
{
dm->qrySearch->Close();
dm->qrySearch->SQL->Clear();
switch(cmbMethod->ItemIndex)
{
case 0: dm->qrySearch->SQL->Add("Select * from CustomerInfo");
dm->qrySearch->SQL->Add("where Customer_ID = :value ");
break;
case 1: dm->qrySearch->SQL->Add("Select * from CustomerInfo");
dm->qrySearch->SQL->Add("where Name = :value");
break;
.....
}
dm->qrySearch->ParamByName("value")->AsString = edtPk->Text;
dm->qrySearch->Open();
if (dm->qrySearch->RecordCount != 0)
ModalResult = 1;
else
{
MessageBox(Handle, "没有该数据", "没找到", MB_OK + MB_ICONERROR);
}
QUERY是动态查询,在BUTTON事件中调用,如下:
void __fastcall TfrmSearch::btnOKClick(TObject *Sender)
{
dm->qrySearch->Close();
dm->qrySearch->SQL->Clear();
switch(cmbMethod->ItemIndex)
{
case 0: dm->qrySearch->SQL->Add("Select * from CustomerInfo");
dm->qrySearch->SQL->Add("where Customer_ID = :value ");
break;
case 1: dm->qrySearch->SQL->Add("Select * from CustomerInfo");
dm->qrySearch->SQL->Add("where Name = :value");
break;
.....
}
dm->qrySearch->ParamByName("value")->AsString = edtPk->Text;
dm->qrySearch->Open();
if (dm->qrySearch->RecordCount != 0)
ModalResult = 1;
else
{
MessageBox(Handle, "没有该数据", "没找到", MB_OK + MB_ICONERROR);
}