adodc1.这里写什么?="select *from 图书信息表 where 编号=101"如果是 编号=ID  ID=text1.text 这又怎么写?

解决方案 »

  1.   

    id是整形
    rs.open "select *from 图书信息表 where 编号="&id,conn,1,3
    是字符串
    rs.open "select *from 图书信息表 where 编号='"& text1.text &"',conn,1,3
      

  2.   

    online的解答完全了~~没有说的·~
      

  3.   

    我想楼上的各位可能没有看清题意:
    首先,楼主说的是Adodc1
       所以要采用Adodc1.connectionstring=cn.connectionstring
                   adodc1.recordsource="select *from 图书信息表 where 编号='"& text1.text &"'"
                   adodc1.refresh
    其次:楼主说:“如果是 编号=ID  ID=text1.text 这又怎么写?”这句话有点本人不理解,第一,表中有ID字段吗?如果有那么SQL语句就要这样写了
       adodc1.recordsource="select *from 图书信息表 where 编号=ID and ID='"& text1.text &"'"(当然ID是字符型)
        如果是整型那么就这样写adodc1.recordsource="select *from 图书信息表 where 编号=ID and ID=" & text1.text 
        
    第二,如果表中没有ID字段,那么只需要这样写就可以了
       adodc1.recordsource="select *from 图书信息表 where 编号='"& text1.text &"'"(当然ID是字符型)
          adodc1.recordsource="select *from 图书信息表 where 编号=" & text1.text 
      

  4.   

    KJ_Wang 说对了 
    俺水平还很低 online的方法我看不懂 太专业了:( 
    我只想把SQL语句 写在代码里 而不是直接写在ADO的COMMANDTEXT里 我想用ADO来做查询
      

  5.   

    其实你需要的是sql语法
    所以我用了rs.open
    你换成这样就行了
    adodc1.recordsource="select *from 图书信息表 where 编号='"& text1.text &"'"一回事
      

  6.   

    adodc1.这里写什么?="select *from 图书信息表 where 编号=101"如果是 编号=ID  ID=text1.text 这又怎么写?
    if isnumeric(text1.text) then
      strsql="select *from 图书信息表 where 编号=" & val(text1.text)
    end if
      

  7.   

    FLC啥意思,学习什么呀??????????????