日期:2014-05-17  浏览次数:20950 次

不能 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