请问如何用ASP代码给ACCESS按一个字段排序

来源:百度知道 编辑:UC知道 时间:2024/06/02 03:47:13
用ASP代码实现为ACCESS中的数据排序
1.数据库中有id、num、paixu等字段
2.要求除id=4,id=6,id=8的数据外,其余的数据都按num字段中的数据大小排序,此字段都是数字类型的
3.将排序结果的id数写入到id=10的paixu字段用“|”分隔,形如2|9|11|5|3,此结果中的数字是相应数据的id,并且相应id对应的num数据按从大到小的顺序排列

请各位高手们帮忙,谢谢

Dim rs,IdNumber,i
set rs=conn.execute("Select id from [table] where id<>4 and id<>6 and id<>8 order by num desc")

if not rs.eof and not rs.bof then
i=1
do while not rs.eof
if i<>1 then
IdNumber=IdNumber & "|"
end if
IdNumber=IdNumber & rs("id")
rs.movenext
loop
end if
rs.close
set rs=nothing