'*********************************************************
' detete 删除数据
'*********************************************************
Sub delete(filetype$,found%) 'found% 为行数
select filetype$
case "instock"
Open "A:instock.Txt" as #2
Field #2,20 as tm$,5 as sl$,2 as czy$,12 as dttm$
Open "A:intemp.Txt" as #8
Clfile #8
Field #8,20 as tm1$,5 as sl1$,2 as czy1$,12 as dttm1$
i%=1
while i% If i%<>found% Then
Get #2,i%
tm1$=tm$
sl1$=sl$
czy1$=czy$
dttm1$=dttm$
If i%>found%Then
Put #8,i%-1
Else
Put #8,i%
End If
End If
i%=i%+1
Wend
Clfile #2
i%=1
while i% Get #8,i%
tm$=tm1$
sl$=sl1$
czy$=czy1$
dttm$=dttm1$
Put #2,i%
i%=i%+1
Wend
Close #8
Close #2
case "outstock"
Open "A:outstock.Txt" as #3
Field #3,20 as tm$,5 as sl$,10 as dj$,10 as je$,2 as czy$,12 as dttm$
Open "A:outtemp.Txt" as #8
Clfile #8
Field #8,20 as tm1$,5 as sl1$,10 as dj1$,10 as je1$,2 as czy1$,12 as dttm1$
i%=1
while i% If i%<>found% Then
Get #3,i%
tm1$=tm$
sl1$=sl$
dj1$=dj$
je1$=je$
czy1$=czy$
dttm1$=dttm$
If i%>found%Then
Put #8,i%-1
Else
Put #8,i%
End If
End If
i%=i%+1
Wend
Clfile #3
i%=1
while i% Get #8,i%
tm$=tm1$
sl$=sl1$
dj$=dj1$
je$=je1$
czy$=czy1$
dttm$=dttm1$
i%=i%+1
Wend
Close #8
Close #3
case "kcstock"
Open "A:kcstock.Txt" as #1
Field #1, 20 as tm$, 20 as mc$, 10 as dj$, 5 as qc$, 5 as rk$, 5 as ck$, 5 as jy$, 12 as dttm$
Open "A:kctemp.Txt" as #8
Clfile #8
Field #8, 20 as tm1$, 20 as mc1$, 10 as dj1$, 5 as qc1$, 5 as rk1$, 5 as ck1$, 5 as jy1$, 12 as dttm1$
i%=1
while i% If i%<>found% Then
Get #1,i%
tm1$=tm$
mc1$=mc$
dj1$=dj$
qc1$=qc$
rk1$=rk$
ck1$=ck$
jy1$=jy$
dttm1$=dttm$
If i%>found%Then
Put #8,i%-1
Else
Put #8,i%
End If
End If
i%=i%+1
Wend
Clfile #1
i%=1
while i% Get #8,i%
tm$=tm1$
mc$=mc1$
dj$=dj1$
qc$=qc1$
rk$=rk1$
ck$=ck1$
jy$=jy1$
dttm$=dttm1$
Put #1,i%
i%=i%+1
Wend
Close #8
Close #1
End Select
while 1
screen 1,0
print
Print "Function is OK !"
print
Print "按任意键退出"
wait 0,1
k$=Input$(1)
Exit Sub
Wend
End Sub
'*****************************
' main
'*****************************
MAIN:
Cls
Out &H6080,1 '0:standard-size; 1:the small-size
screen 1,0
call delete("kcstock",4)
ERRCOMM:
Cls
Beep 8
'Print "操作错误:"
'Print
'Print "按任意键退出";
'Wait 0,1
'k$=Input$(1)
End
阅读(1697) | 评论(0) | 转发(0) |