int CurrentPage=3;
strSQL.Format("SELECT TOP 32 SID FROM Equipment WHERE (SID NOT IN (SELECT TOP 32*'%d' SID FROM Equipment group by SID ORDER BY SID)) group by SID ORDER BY SID",CurrentPage);
m_pRecordset=m_pConnection->Execute((_bstr_t)strSQL,NULL,adCmdText);//select * from History_Record authorsstrSQL.Format("SELECT TOP 32 SID FROM Equipment WHERE (SID NOT IN (SELECT TOP 32*'%d' SID FROM Equipment group by SID ORDER BY SID)) group by SID ORDER BY SID",CurrentPage);
执行当前语句错误???
解决方案 »
- 谁能给个vs2008写的分割窗口的示例?
- 请问如何将这段C代码改成基于对话框的VC程序?
- AttachDispatch
- ADO + SQLServer创建表失败.[奇怪]
- 如何绘制listCtrl头的三角?
- D3D的光照效果和纹理效果????
- 谁有关于程序开发的QQ组,多多益善.
- 帮帮忙,哪有powerdesigner的电子书籍下载?
- 谁做过类似photoshop的东东????????????????????????
- 用ADO修改表结构的问题...请帮忙!!!
- combobox 获取选中的值
- 最近比较穷(换成下载分了) 帮我看下GDI+ GraphicsPath AddString一个不合法参数的问题
这是神马玩意?
还是写个好点的SQL语句吧
这个即使勉强成功,后期维护也是问题
int CurrentPage=32;
strSQL.Format("SELECT TOP 32 SID FROM Equipment WHERE (SID NOT IN (SELECT TOP %d SID FROM Equipment group by SID ORDER BY SID)) group by SID ORDER BY SID",CurrentPage*2);上面语句如何用SQL语句实现?
declare @CurrentPage int
declare @TotalPage int
declare @strsql nvarchar(200)
set @CurrentPage=32
set @TotalPage=32
set @strsql='SELECT TOP'+str(@CurrentPage)+' sid FROM equipment WHERE (SID NOT IN (SELECT TOP ' +str(@TotalPage)+' SID FROM Equipment group by SID ORDER BY SID))group by SID ORDER BY SID'
exec(@strsql)
go
select getdate()
SELECT TOP 12 RecordDate FROM History_Record WHERE ( RecordDate>='2011-05-29 00:00:00:000' and RecordDate<='2011-05-29 23:59:59:000' and
RecordDate
NOT IN (SELECT TOP 24 RecordDate FROM History_Record Where RecordDate>='2011-05-29 00:00:00:000' and RecordDate<='2011-05-29 23:59:59:000' ORDER BY RecordDate))
ORDER BY RecordDate
select getdate()
code]
查询时间竟然有2秒??