BOOL CXYZAdo::OpenTable(CString strTable,CString strcolmn)
{
CString strSql;
strSql = "select * from " + strTable+"where Partname="+strcolmn+;
一个数据查询函数,两个参数是表名和查询条件,正确的sql语句怎么写?
{
CString strSql;
strSql = "select * from " + strTable+"where Partname="+strcolmn+;
一个数据查询函数,两个参数是表名和查询条件,正确的sql语句怎么写?
strSql.Format("select * from %s where Partname='%s'", strTable, strcolmn);
简洁明了,多好。:P
strSql = "select * from strTable where Partname='"+strcolmn+"';
这个方法好用,谢谢!
能简单跟我说一下 format的用法吗?msdn 看不大懂
%s表示字符串变量,相当于连接字符串