sql = "select * from Device where DeviceName="+CString("'") + dlg.m_strDevice + CString("'") + "and ProgID =" + CString("'") + iProgID + CString("'");

解决方案 »

  1.   

    "and ProgID =" and前面有空格吗????
      

  2.   

    debug模式下,跟踪到此语句,看他执行后的值,再分析一下不就知道了?
      

  3.   

    error C2666: '+' : 4 overloads have similar conversions
      

  4.   

    不懂为什么要+CString("'")
    sql = "select * from Device where DeviceName='"+ dlg.m_strDevice + "' and ProgID ='" + iProgID + "'";
      

  5.   

    用了 ringphone(临风) 的出错还是:error C2666: '+' : 4 overloads have similar conversions难道这么个语句就这么难?
      

  6.   

    可能是CString的operator + 的问题,试试
    sql = CString("select * from Device where DeviceName='") + dlg.m_strDevice + "' and ProgID ='" +  iProgID + "'";
    如果还有错试试先不加iProgID
      

  7.   

    iProgID是不是整型的,如果是那可能出错了,整型的数怎么能跟字符串相连啊