用Delphi,在前台利用输入参数(属性名),对后台sql表查询后,
能否对记录做如下处理:对记录中某个属性值进行分析,比如说,对得到的一条记录中,如果,年龄<25,则弹出一个对话框a,如果年龄>40,则弹出对话框b,
这个代码要如何编写,是否因为是利用动态查询,调用一个存储过程方便些~~~
请高手指教~谢谢```

解决方案 »

  1.   

    if query1.fieldbyname('年龄').AsInteger<25 then
    begin
    FrmADialog := TFrmADiaglog.create(Application);
    try
    FrmADialog.showmodal;
    finally
    FrmAialog.free;
    end
    else if query1.fieldbyname('年龄').AsInteger<25 then
    begin
    FrmBDialog := TFrmBDiaglog.create(Application);
    try
    FrmBDialog.showmodal;
    finally
    FrmBDialog.free;
    end;
    //
      

  2.   

    //不好意思,写错了
    //首先做好2个对话框的窗体,然后引用。
    if query1.fieldbyname('年龄').AsInteger<25 then
    begin
    FrmADialog := TFrmADiaglog.create(Application);
    try
    FrmADialog.showmodal;
    finally
    FrmAialog.free;
    end;
    end
    else if query1.fieldbyname('年龄').AsInteger<25 then
    begin
    FrmBDialog := TFrmBDiaglog.create(Application);
    try
    FrmBDialog.showmodal;
    finally
    FrmBDialog.free;
    end;
    end;
    //
      

  3.   

    在查询出的数据集中判断不就可以吗?
    if adoquery1.fieldbyname('age').asinteger<25 then
      showmessage('<25');
      

  4.   

    if strtofloat(edit1.text)>40 then
    showmessage.....
    if strtofloat(edit1.text)<20 then 
    showmessage......
      

  5.   

    你可以在dbgrid中用不同的颜色表示