求助:数据库表某列向上统计空白格数,直到向上方向有数字为止,该怎样编程?小女子向大侠请教。
求助:数据库表某列向上统计空白格数,直到向止方向有数字为止,该怎样编程?小女子向大侠请教。
Clear All Clear Create Cursor tt ( xh N(6),缺席 c(2),姓名 c(6),性别 c(2) ) Insert Into tt Values(0," ","甲","男") Insert Into tt Values(0,"1","甲","男") Insert Into tt Values(0," ","甲","男") Insert Into tt Values(0,"1","甲","男") Insert Into tt Values(0," ","甲","男") Insert Into tt Values(0," ","甲","男") Insert Into tt Values(0,"","甲","男") Replace xh With Recno() All Go Top Browse *方法1 Store 0 To lnshu Go Bottom Do While Not Eof() If Empty(缺席) lnshu=lnshu+1 Else Exit Endif Skip -1 Enddo ?lnshu Messagebox("缺席"+Transform(lnshu)+"人") If lnshu>0 GO BOTTOM &&&可以省略本句 Append Blank Replace 缺席 With Alltrim(Str(lnshu)) Endif Browse *方法2 Calculate Max(Recno()) To ncount1 For Not Empty(缺席) If ncount1>=Reccount() Go Top Messagebox("无缺席") Else Go ncount1 Count Rest To ncount2 For Empty(缺席) Messagebox("缺席"+Transform(ncount2)+"人") GO BOTTOM &&&可以省略本句 Append Blank Replace 缺席 With Alltrim(Str(ncount2)) ENDIF BROWSE
[此贴子已经被作者于2024-8-7 16:06编辑过]