VB+SQL2000,  为什么不识别 "select 表A.名称 from 表A," & Comb.Item(1).Text & " where 表A.名称=" & Comb.Item(1).Text & ".名称 and " & strFilter & ""呢?
   Comb.Item(1).Text 代表一个表名
   strFilter=表A.名称 and 表A.地点
   帮忙看看吧!毕设急!

解决方案 »

  1.   

    分开调
    先看
    "select 表A.名称 from 表A," & Comb.Item(1).Text & " where 表A.名称=" & Comb.Item(1).Text & ".名称"
    有没有问题
    再看
    "select 表A.名称 from 表A," & Comb.Item(1).Text & " where " & strFilter & ""
    有没有问题
    最好把上面的Sql语句在执行前打印出来查一下错误。
      

  2.   

    "select A.name from A," & cstr(trim(comb.item(1).text)) & " where _
    A.name = " & cstr(trim(comb.item(1).text)) & ".name and " 前面我觉得就是应该注意一下空格的问题,后面呢,strFilter具体是什么,我怎么看得有些糊涂?
      

  3.   

    在debug 窗口,看看自己写的具体的SQL语句是不是有些毛病!
      

  4.   

    "select 表A.名称 from 表A." & Comb.Item(1).Text 
      

  5.   

    select 表A.名称 from 表A." & Comb.Item(1).Text & " where " & strFilter & ""
      

  6.   

    先把以下的内容当做字符串处理。
    select 表A.名称 from 表A," & Comb.Item(1).Text & " where 表A.名称=" & Comb.Item(1).Text & ".名称 and " & strFilter & "
      

  7.   

    select 表A.名称 from 表A where 表A.名称=(select 名称 from " & comb.item(1).text & ")
      

  8.   

    请楼主把拼装后的SQL语句贴到这里不就一幕了然了