Freetds sqlerror:执行update语句时游标状态无效

Freetds sqlerror:执行update语句时游标状态无效,sql,c,freetds,Sql,C,Freetds,具有低于C的代码 sprintf("cmdstr", "update tablename set reply=\'%c\', msg=\'%-200.200\' , date=getdate() where machine=\'%-15.15\'",reply,msg,machine); hstmt=SQL_NULL_HSTMT if((hstmt==execSQLStatement(&hdbc,cmdstr))==SQL_NULL_HSTMT)

具有低于C的代码

sprintf("cmdstr", "update tablename set reply=\'%c\', msg=\'%-200.200\' , date=getdate() where machine=\'%-15.15\'",reply,msg,machine);

hstmt=SQL_NULL_HSTMT
if((hstmt==execSQLStatement(&hdbc,cmdstr))==SQL_NULL_HSTMT){
  printf(update failed %d",retcode);
}
执行此update语句时,获取update失败retcode=-1,错误为无效游标状态,插入的表中包含reply=G、msg=NULL、date=NULL machine=“ip地址”


此问题是因为update语句还是sql freetds库?请帮助

您确实需要,也不希望,用反斜杠转义数据库单引号。在执行之前检查
cmdstr