ADOTable1.Fitter := 'locate in ('''+'英国'''+','+'''法国'''+','+'''荷兰'''+')';
ADOTable1.Fittered := true;出错提示:数据类型不正确,或不再可以接受的范围之内,或与其他参数冲突但是改查询语句在SQL查询分析器中执行是正确的
select * from table1 where locate in ('英国','法国','荷兰')请问应该怎么写?在线等。

解决方案 »

  1.   

    ADOTable1.Fitter := 'locate in ('+'''英国'''+','+'''法国'''+','+'''荷兰'''+')';
    ADOTable1.Fittered := true;
      

  2.   

    慢慢来 :ADOTable1.Fittered := false ;ADOTable1.Fitter :=
     
    'locate in ('+ QuotedStr('英国') + ','+ QuotedStr('法国')
     
    + ','
     
    + QuotedStr('荷兰') + ')';ADOTable1.Fittered := true;
      
      

  3.   

    二 : ADOTable1.Fittered := false ;ADOTable1.Fitter :=
     
    'locate in ('+ '''' + '英国' + '''' + ','+ '''' + '法国' + ''''+ ','+ '''' + '荷兰' + '''' + ')';ADOTable1.Fittered := true;
      

  4.   

    ADOTable1.Fitter := 'locate in ('''+'英国'''+','+'''法国'''+','+'''荷兰'''+')';
    --------------------------------------------------------------------------------
    想查询法国应该用
    select * from table1 where charindex(','+法国+',',','+'''+'英国'''+','+'''法国'''+','+'''荷兰'''+'+',')>0
      

  5.   

    楼主,记住规则,'在字符串中应表示为''
    所以你的sql应该表示为:
      'select * from table1 where locate in (''英国'',''法国'',''荷兰'')'
      

  6.   

    ADOTable1.Fitter := 'locate in ('+'''英国'''+','+'''法国'''+','+'''荷兰'''+')';
    ADOTable1.Fittered := true;