创建新用户源代码:
Private Sub CmdOk_Click()
On Error GoTo gl
If Txt(1).Enabled = False Then
If rs.State Then
rs.Close
End If
rs.Source = "select * from usertable where username= '" & MSF.TextMatrix(MSF.row, 0) & "'"
rs.Open , cn, adOpenKeyset, adLockOptimistic
rs!UserName = Trim(Txt(0).Text)
rs.Update
rs.Close
Set rs = Nothing
MSF.TextMatrix(MSF.row, 0) = Txt(0).Text
CmdAdd.Enabled = True
CmdAdd.SetFocus
Exit Sub
End If
CmdCancel.Enabled = False
If Len(Trim(Txt(2).Text)) = 0 Or Len(Trim(Txt(0).Text)) = 0 Or Len(Trim(Txt(1).Text)) = 0 Then
MsgBox " 数据不完整,请检查! ", , "提示信息"
Exit Sub
End If
If Trim(Txt(2).Text) <> Trim(Txt(1).Text) Then
MsgBox " 两次密码值不相等! ", , ginfo
Exit Sub
End If
Set rs = New ADODB.Recordset
rs.Source = "select * from usertable order by id"
rs.Open , cn, adOpen