有这么一个表:
表名:cpjbxx
字段:gzh                (类型是vachar(60))
     101-1396
    101-1292
    .........
   2008备份-524
当执行:select * from cpjbxx where gzh='"&101-1396&"'语句时,怎么没有结果啊?这是为什么啊? 

解决方案 »

  1.   

    select * from cpjbxx where gzh like '%101-1396%'
      

  2.   

    select * from cpjbxx where gzh='101-1396'
      

  3.   

    select * from cpjbxx where gzh='&101-1396&'
    --去掉你的双引号
      

  4.   

    select * from cpjbxx where charindex('101-1396',gzh)>0
      

  5.   

    “gzh='"&101-1396&"'”写法有问题,貌似VB.net中添加变量
      

  6.   

    select * from cpjbxx where charindex('101-1396',gzh)>0
    这样输入是正确的,担不是很明白为什么?
    非常感谢楼上两位....
    其他的查询方式还是有点小小的问题...
      

  7.   

    select * from cpjbxx where charindex('101-1396',gzh)>0
    这一句是可以的,但还是不很明白原因。
    其他的还是有点问题,谢谢楼上的2位高手..
      

  8.   

    这句还有什么问题呢?
    你可以去看下charindex函数
      

  9.   

    谢谢各位了,尤其是feixianxxx....
    非常感谢