4,016
社区成员
发帖
与我相关
我的任务
分享
// %d, %f,在CString格式化的时候,对应的参数是数值型
// %s,对应的参数是字符串
// 比如
CString strSQL;
CString strNumber = "123";
CString strName = "zhangsan"
str.Format("SELECT * FROM table WHERE id = %d AND NUM = %s AND [Name] = '%s'", 100, strNubmer, strName);
// 结果就是 strSQL == "SELECT * FROM table WHERE id = 100 AND NUM = 123 AND [Name] = 'zhangsan'"