如题:
    判断Adodc1.Recordset!xm_code 中是否有text1.text的内容
    类似于
   str1 = "select * from  zd_sf  where xm_code = '"& Text1.Text &"'" 
     Rs.Open str1, Cn, adOpenKeyset, adLockOptimistic
      If Rs.RecordCount > 0 Then

解决方案 »

  1.   

    str1 = "select * from  zd_sf  where xm_code like '%"& Text1.Text &"%'" 
    if rs.state<>adstaetclosed then rs.close
    Rs.Open str1, Cn, adOpenKeyset, adLockOptimistic 
    If Rs.RecordCount > 0 Then
        msgbox "有"
    else
        msgbox "无"
    end if
    rs.close
      

  2.   

    str1 = "select * from  zd_sf  where xm_code like '%"& Text1.Text &"%'" 
    if rs.state<>adstaetclosed then rs.close
    Rs.Open str1, Cn, adOpenKeyset, adLockOptimistic 
    If Rs.RecordCount > 0 Then
        msgbox "有"
    else
        msgbox "无"
    end if
    rs.close
      

  3.   

    我的意思是在不执行select语句的情况下,判断出Adodc1.Recordset!xm_code中是否含有text1.text 
      

  4.   

    instr(1,Adodc1.Recordset!xm_code,text1.text)=0就是没有,反之就有
      

  5.   

    instr(1,Adodc1.Recordset!xm_code,text1.text)>0
    如果包含字母的话,可以把字母都转换为大写或小写
      

  6.   

    instr(1,Adodc1.Recordset!xm_code,text1.text)=0这个办法已经比较接近了,但是只能检验adodcAdodc1.Recordset!xm_code中的第一条记录的xm_code是不是和text1.text一样第二条就检验不出来了,请问还有什么好办法吗
      

  7.   

    为什么不用select?
    用存储过程吧
      

  8.   

    难道不使用select
    利用类似于instr(1,Adodc1.Recordset!xm_code,text1.text)>0的方法不能解决吗