天堂2 新版本:神秘程序!!!!

来源:百度文库 编辑:神马品牌网 时间:2024/04/19 07:55:56
............................... frmAdduser 添加用户窗口代码 .....................................
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String

If Trim(Text1(0).Text) = "" Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Text1(0).SetFocus
Else
txtSQL = "select * from user_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(Text1(0)) Then
MsgBox "用户已经存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
Text1(0).SetFocus
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If

If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "两次输入密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub

Else
If Text1(1).Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Else
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0).Text)
mrc.Fields(1) = Trim(Text1(1).Text)
mrc.Update
mrc.Close
Me.Hide
MsgBox "添加用户成功!", vbOKOnly + vbExclamation, "添加用户"
End If
End If
End Sub

.........................................................................................................

神秘回答!你问的什么啊?