用 COMBO的CLICK、或CHANG 事件,加上一个SQL语句就OK

解决方案 »

  1.   

    ADODC控件,绑定到datagridadodc1.recordsouce = "select * from yourtable where " & combo1.text & " = '" & text1 & "'"
    adodc1.refresh
      

  2.   

    不要用COMBO的CLICK事件。因为你还要等待用户在text中输入。
    加一个command按钮,设置default=true,另外form的previewkey=true。这样用户回车时自动触犯按钮。
      

  3.   

    我就是想在text输入查询的内容的,只是让它跟combo里的内容对应
      

  4.   

    那个绑定怎么绑啊?
    我放在command的CLICK里的,是这样的吗?
    我放在那好象不行啊?
    " & combo1.text & " = '" & text1 & "'
    是这样写的吗?
    请指教
    初级水平
    望指教
      

  5.   

    绑定:
    把datagrid的datasource属性设置为adodc1。adodc1.recordsouce = _
      "select * from yourtable where " & combo1.text & " = '" & text1 & "'"
      

  6.   

    不用跟adodc1绑定
    直接连数据库就行了,然后写
              rs.Open "select 项目名称,项目来源,总经费,成果名称,科技年度,获奖类别与等级,发表论著 from rckjlgl  where " & Combo1.Text & " = '" & Text1 & "' and " & Combo2.Text & " = '" & Text2 & "' and " & Combo3.Text & " = '" & Text3 & "'"
              Set DataGrid1.DataSource = rs
    就可以了