为何VC++用select * from从数据库读取全部数据为升序,按时间条件读出为降序 5

按降序代码:CStringstrSQL;strSQL.Format("select*fromemployeeswhere时间between#%s#and#%s#",(CS... 按降序代码:
CString strSQL;
strSQL.Format("select * from employees where 时间 between #%s# and #%s# " ,(CString)m_start, (CString)m_end);
_bstr_t bstrSQL = strSQL;
其它一样。
全部读出不同的代码:
_bstr_t bstrSQL = "select * from employees order by ID desc";
//创建记录集指针对象实例
m_pRecordset.CreateInstance(__uuidof(Recordset));

问题的确在ID desc,但按条件选择,desc不知加哪里才对?
展开
 我来答
njlcliubing
2015-02-22 · TA获得超过187个赞
知道小有建树答主
回答量:221
采纳率:0%
帮助的人:108万
展开全部
在#%s# and #%s# 后面,引号" 的前面加上:order by ID desc即可。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式