当前位置: 代码迷 >> ASP >> 不能 DELETE Top 200 吗?解决办法
  详细解决方案

不能 DELETE Top 200 吗?解决办法

热度:862   发布时间:2012-02-20 21:18:23.0
不能 DELETE Top 200 吗?
下面这错在何处?

set rs2=Server.CreateObject("Adodb.Recordset")

sql2="DELETE Top 2000 FROM Images order by Image_id desc"

rs2.open sql2,conn,1,3

rs2.close
set rs2=nothing


------解决方案--------------------

'不行
set rs2=Server.CreateObject("Adodb.Recordset")
sql2="select top 2000 * FROM Images order by Image_id desc"
rs2.open sql2,conn,1,3 
conn.execute("delete from Images where Image_id<="&rs2("Image_id"))
rs2.close
set rs2=nothing
------解决方案--------------------

'不行
set rs2=Server.CreateObject("Adodb.Recordset")
sql2="select top 2000 * FROM Images order by Image_id desc"
rs2.open sql2,conn,1,3
rs2.movelast
=================加上这句试试rs2.movelast

conn.execute("delete from Images where Image_id<="&rs2("Image_id"))
rs2.close
set rs2=nothing
  相关解决方案