strQuery = "insert orders (order_id,customer_id,customer_name,product_id,product_name,product_type,
values ('"+strClum[0]+"','"+strClum[1]+"',\
'"+strClum[2]+",'iNumber,fprice,fmoney)"
//iNumber, fprice,fmoney is varible //出错了
strClum[] is CString //ok
我的意思就是想用iNumber, fprice,fmoney 变量的值
values ('"+strClum[0]+"','"+strClum[1]+"',\
'"+strClum[2]+",'iNumber,fprice,fmoney)"
//iNumber, fprice,fmoney is varible //出错了
strClum[] is CString //ok
我的意思就是想用iNumber, fprice,fmoney 变量的值
'"+strClum[2]+"',iNumber,fprice,fmoney)"你可以将字符串打印出来到数据库中调试
strQuery.Format("insert orders (order_id, customer_id, customer_name, product_id, product_name, product_type) values (%d, %d, '%s', %d, '%s', '%s')", strClum[0],
strClum[1], strClum[2], iNumber, fprice, fmoney);fprict 和 fmoney 如果是数字的话:
strQuery.Format("insert orders (order_id, customer_id, customer_name, product_id, product_name, product_type) values (%d, %d, '%s', %d, %d, %d)", strClum[0],
strClum[1], strClum[2], iNumber, fprice, fmoney);
注意字段是char型的值两边写单引号,并且他们是char *的或者是cstring的
你的方法不行