你可以将数据环境unload ,然后再重设查询

解决方案 »

  1.   

    对应SQL 中的一个表建了一个COMMAND(COMMAND11),可我想每次 DATAEnvironment.COMMAND11  时得到不同条件的结果,怎么干?
    大家为什么不来回答?要我加分吗?
      

  2.   

    1,Set the command type: SQL String
    2,Set the SQL String = "Select * form table", this will return a recordset.
      Attention: Don't join the "where" sub string.
    3,During the run time, reset CommandText of the Command (Add the "Where age>30" sub string) and reexecute it. That will return a recordset of your need(Age>30)
    4,Use the recordset to fill the datagrid(Don't use the bound).Sorry! I can't input chinese for you. Please try it!
      

  3.   

    MildSeven(看名字应是为老兄):
       你说的正是我想做的,关键是:改动Commandtext 怎么做到?DATAEnvironment.COMMAND11 .Commandtext=......+"WHERE AGE >30"不行啊。
       我看你能理解我的低层次思路, 谢谢。一旦成功,分数奉上。
      

  4.   

    '1,Reset the commandtext of commands collection's command1
    DataEnvironment1.Commands("command1").CommandText = "Select companyid from tokui where age > 30"'2,Re-execute this method
    DataEnvironment1.Command1'3,Verify the result RecordSet,You can change your action at here
    Do While Not DataEnvironment1.rsCommand1.EOF    Debug.Print DataEnvironment1.rsCommand1!companyid
        DataEnvironment1.rsCommand1.MoveNext
    LoopPlease verify your condition and try again.
      

  5.   

    To SDLLJ:
    If the recordset object is open, Of cause you will close it.
    This is so siample that you should think it.
      

  6.   

    俺太笨, SO SIAMPLE 的事也要问明白。
    请支持。
      

  7.   

    加上下面的代码,就ok!你也是新手,我看得出来:欢迎你来信,我与你共同讨论:
                                              [email protected]
    if dataenvironment1.rscommand1.state=adstateopen then
       dataenvironment1.rscommand1.close
    end if