程序使用次数限制?
在输入完密码后判断,if 系统日期=2012年10月1日 提示:“系统数据库损坏,请与程序员联系。” qiut
具体命令应该怎么写
[解决办法]
FORM1 = NEWOBJECT("C_Form")
FORM1.SHOW
READ EVENTS
RETURN
DEFINE CLASS C_FORM AS FORM
AUTOCENTER=.T.
BORDERSTYLE=2
CAPTION="系统登录"
CLOSABLE=.F.
HEIGHT=140
MAXBUTTON=.F.
MOVABLE=.F.
SHOWWINDOW=2
WIDTH=200
WINDOWTYPE=1
ADD OBJECT LABEL1 AS LABEL WITH AUTOSIZE=.T.,CAPTION="用户名称",TOP=30,LEFT=16,HEIGHT=28,WIDTH=40,FONTSIZE=11
ADD OBJECT LABEL2 AS LABEL WITH AUTOSIZE=.T.,CAPTION="用户密码",TOP=66,LEFT=16,HEIGHT=28,WIDTH=40,FONTSIZE=11
ADD OBJECT TEXT1 AS TEXTBOX WITH TOP=21,LEFT=85,HEIGHT=24,FONTSIZE=11
ADD OBJECT TEXT2 AS TEXTBOX WITH TOP=57,HEIGHT=24,LEFT=85,FONTSIZE=11,PASSWORDCHAR="*"
ADD OBJECT SHAPE1 AS SHAPE WITH BACKSTYLE=0,HEIGHT=85,LEFT=10,SPECIALEFFECT=0,TOP=11,WIDTH=181
ADD OBJECT COMMANDGROUP1 AS COMMANDGROUP WITH BUTTONCOUNT=2,LEFT=10,HEIGHT=38,TOP=96,WIDTH=181
PROCEDURE COMMANDGROUP1.INIT
WITH THISFORM.COMMANDGROUP1
.AUTOSIZE=.T.
.VALUE=0
WITH .COMMAND1
.CAPTION="确定"
.FONTSIZE=11
.HEIGHT=28
.LEFT=5
.TOP=5
.WIDTH=48
ENDWITH
WITH .COMMAND2
.CAPTION="退出"
.FONTSIZE=11
.HEIGHT=28
.LEFT=128
.TOP=5
.WIDTH=48
ENDWITH
ENDWITH
ENDPROC
PROCEDURE INIT
THISFORM.ADDPROPERTY("CS",0) &&为表单增加一个CS属性,用于保存登录次数
THISFORM.SETALL("FORMAT","T","TEXTBOX")
*---密码表
CREATE CURSOR 登录用户 (用户名称 C(10),用户密码 C(10))
INSERT INTO 登录用户 VALUES ("admin","123456")
ENDPROC
PROCEDURE COMMANDGROUP1.COMMAND1.CLICK &&确定按钮代码
THISFORM.CS=THISFORM.CS+1
LOCATE FOR ALLTRIM(登录用户.用户名称)==THISFORM.TEXT1.VALUE AND ALLTRIM(登录用户.用户密码)==THISFORM.TEXT2.VALUE
IF FOUND()
IF DATE()>={^2012.10.01}
MESSAGEBOX("系统数据库损坏,请与程序员联系。",64,"系统信息")
CLEAR EVENTS
QUIT
ELSE
THISFORM.RELEASE
DO FORM SYS(5)+SYS(2003)+"\FORMS\MAIN.SCX"
ENDIF
ELSE
IF THISFORM.CS<3
MESSAGEBOX("用户名称或用户密码第 "+TRANSFORM(THISFORM.CS)+" 次输入错误",48,"系统信息")
THISFORM.SETALL("VALUE","","TEXTBOX")
THISFORM.TEXT1.SETFOCUS
ELSE
THISFORM.RELEASE
CLEAR EVENTS
ENDIF
ENDIF
ENDPROC
PROCEDURE COMMANDGROUP1.COMMAND2.CLICK &&退出按钮代码
THISFORM.RELEASE
CLEAR EVENTS
ON SHUTDOWN QUIT
QUIT
ENDPROC
PROCEDURE DESTROY
CLEAR EVENTS
ENDPROC
ENDDEFINE