请问下这个SQL语句错在什么地方
请教下这个SQL语句错在什么地方?
sql.Format(_T("select a.code,a.name,b.nownum,b.maxnum,b.minnum from tb_mat_code a , tb_mat_inventory b where a.code='%s' and b.code='%s'"),c_code);
//选择两个数据库表中code字段值为c_code的记录.
------解决方案--------------------
没细看,你的参数不匹配,where a.code='%s' and b.code='%s'"),c_code,这里少个参数
------解决方案--------------------
------解决方案--------------------
sql.Format(_T("select a.code,a.name,b.nownum,b.maxnum,b.minnum from tb_mat_code a , tb_mat_inventory b where a.code=\'%s\' and b.code=\'%s\'"),c_code, c_code);
sql.Format(_T("select a.code,a.name,b.nownum,b.maxnum,b.minnum from tb_mat_code a , tb_mat_inventory b where a.code='%s' and b.code='%s'"),c_code);
//选择两个数据库表中code字段值为c_code的记录.
------解决方案--------------------
没细看,你的参数不匹配,where a.code='%s' and b.code='%s'"),c_code,这里少个参数
------解决方案--------------------
------解决方案--------------------
sql.Format(_T("select a.code,a.name,b.nownum,b.maxnum,b.minnum from tb_mat_code a , tb_mat_inventory b where a.code=\'%s\' and b.code=\'%s\'"),c_code, c_code);