CString sql;
sql.Format("call add_customer_info_tab(%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s','s','s')",NewID,m_strName,m_strSelectedArea,m_strSelectedProfession,m_strSelectedVocation,m_strCompany,m_strSelectApproach,m_strEmail,m_strPhone,m_strMobile,m_strInterest,m_strMemo);

m_db.ExecuteSQL(sql);
请问这条语句有什么语法错误?
执行时提示    '6'附近有语法错误
我的NewID 的值是6存储过程的参数匹配我检查过很多遍,确认没错

解决方案 »

  1.   

    CString sql;
    sql.Format("   -- 引号1
    call add_customer_info_tab(%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s','s','s')" -- 引号2  ,下面没有???? 
    ,NewID,m_strName,m_strSelectedArea,m_strSelectedProfession,m_strSelectedVocation,m_strCompany,m_strSelectApproach,m_strEmail,m_strPhone,m_strMobile,m_strInterest,m_strMemo);
      

  2.   

    猜测'%s'是不是不用单引号 ,没用过mfc,完全猜测。
      

  3.   


    这个嘛确实是用单引号
    SQL中的字符串都是用单引号,和C++不同。
      

  4.   

    对于这个  call的语法 我查了 SQL Server 联机丛书
    确实是这样使用
    但不论是在VS下
    还是将
    call add_customer_info_tab(%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s','s','s')
    拷贝到SQL Server 的查询中
    都会报上述的同样的错误不过 使用execute 语句却不会出错,execute语法如下
    execute add_customer_info_tab %d,'%s','%s','%s','%s','%s','%s','%s','%s','%s','s','s'
      

  5.   

    你把调用时生成的那一串符号显示出来,看是否满足SQL的语法.
      

  6.   


    生成的那串符号就是
    call add_customer_info_tab(%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s','s','s')完全满足语法啊