txtsql = "select * from project_spec where type = '" & Opt_inner.Value & "'"
这是我要执行的SQL语句,根据单选按钮的选择与否来找出相关记录,用的数据库为access,该字段的类型为 “是/否”中的“真/假“,不知道何故如此!

解决方案 »

  1.   

    Opt_inner.Value 的类型是integer吧,能直接和字符串&?
      

  2.   

    这样试试:
    dim s as stringselect case Opt_inner.Value 
        case 0
            s="false"
        case 1
            s="true"
    end select txtsql = "select * from project_spec where type = " & s & ""
      

  3.   

    txtsql = "select * from project_spec where type = '" & Opt_inner.Value & "'"
    字符串才需要用'括起来,试试
    txtsql = "select * from project_spec where type = " & cbool(Opt_inner.Value)