就是判断dbtext7的值是否与表vip中vipname相同,相同则执行dbedit1*discount1(vip中的字段) 
这样写对吗?
procedure TfrmRoomBalance.edtKipDaysChange(Sender: TObject);
begin
    if ((edtKipDays.Text <> '')and(txtRoomPrice.Caption <> ''))then
    DBedit1.Text := FloatToStr(StrToFloat(edtKipDays.Text)*StrToFloat(txtRoomPrice.Caption)); //总房价=居住天数*房价
    begin
    DM.qryVIP.Close;
    DM.qryVIP.SQL.Clear;
    DM.qryVIP.SQL.Add('SELECT * FROM VIP');
    DM.qryVIP.SQL.Add('WHERE 0=0');
    DM.qryVIP.Open;
    if DM.qryVIP.Active then
      begin
        if DBText7.Caption = DM.qryVIP.FieldByName('VIPName').AsString  then
        //判断DBText7与VIPName字段是否相同
        DBedit2.Text := FloatToStr(StrToFloat(DBedit1.Text)*
                            DM.qryVIP.FieldByName('Discount1').AsFloat)
            //相同,执行总房价*折扣率=折扣
      end

    end;
end;