现已有一个表"现金明细表"这个表中有"日期,号据,借款人,贷款人,备注"想实现在这个表中的查询功能,比如在text中输入关键字,例:11-7(日期)或者张**(借方)之类的,则自动搜索所有记录并把所有含有此类关键字的记录显示在datagrid当中.应该如何做呢!高手能不能给个代码!!!谢谢了!
还有一个是adodc.datasource已经被我绑定一个表了怎么再去清除这个绑定呢?

解决方案 »

  1.   

    模糊查询么 
    例句:
    Dim sele As String
    Dim cha As String
    cha = Text1.Text
    sele = "select * from students where stuname like'%" + cha + "%'"
    Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=student;Data Source=MICROSOFT01"
    Adodc1.RecordSource = sele
    Adodc1.Refresh
    DataGrid1.Refresh
    --------------------------------------------------------------------------------------------
    右键点击ADODC控件 属性 把USER CONNECTION STRING 清空
      

  2.   

    谢谢,翻了一下SQL书知道怎么做了!