# Re: 再请教,请问是否能用vb6 code 自动将要删除的资料删除

Posted by 小v on June 17, 1999 at 16:20:37:

In Reply to: 再请教,请问是否能用vb6 code 自动将要删除的资料删除 posted by Lucky on June 17, 1999 at 14:12:28:

: 请问是否能用vb6 code 自动将要删除的资料删除,
: 用什么方法可以做到?

VB6我不熟!

以下为使用vb6 DAO将重覆的学号只保留第一笔,其余删除的程式码:(注: 程式未经实际测试)

set rs=db.OpenRecordset("select * from [LIST] order by [学号]",dbOpenDnaset)
if rs.recordcount>0 then
with rs
.movefirst
tmpS = .fields("学号")
.movenext
do while not .eof
if tmpS=.fields("学号") then
.delete
else
tmpS=.fields("学号")
endif
.movenext
loop
end with
endif

Follow Ups: