英语翻译Private Sub cmdOK_Click()Dim SQL As StringDim rs As ADODB.RecordsetIf Trim(UserName.Text) = "" Then MsgBox "请输入用户名称!",vbOKOnly + vbExclamation,"警告"Exit SubUserName.SetFocusElseSQL = "select * from UserInfo where UserID='

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/16 10:24:39
英语翻译PrivateSubcmdOK_Click()DimSQLAsStringDimrsAsADODB.RecordsetIfTrim(UserName.Text)=""ThenMsgBox"请输

英语翻译Private Sub cmdOK_Click()Dim SQL As StringDim rs As ADODB.RecordsetIf Trim(UserName.Text) = "" Then MsgBox "请输入用户名称!",vbOKOnly + vbExclamation,"警告"Exit SubUserName.SetFocusElseSQL = "select * from UserInfo where UserID='
英语翻译
Private Sub cmdOK_Click()
Dim SQL As String
Dim rs As ADODB.Recordset
If Trim(UserName.Text) = "" Then MsgBox "请输入用户名称!",vbOKOnly + vbExclamation,"警告"
Exit Sub
UserName.SetFocus
Else
SQL = "select * from UserInfo where UserID='" & UserName & "'"
Set rs = TransactSQL(SQL)
If rs.EOF = False Then MsgBox "这个用户已经存在!请重新输入用户名称!",vbOKOnly + vbExclamation,"警告"
UserName.SetFocus
UserName.Text = ""
PassWord.Text = ""
confirmPWD.Text = ""
Exit Sub
Else
If Trim(PassWord.Text) Trim(confirmPWD.Text) Then MsgBox "两次输入的密码不一致,请重新输入密码!",vbOKOnly + vbExclamation,"警告"
PassWord.Text = ""
confirmPWD.Text = ""
PassWord.SetFocus
Exit Sub
ElseIf Trim(PassWord.Text) = "" Then MsgBox "密码不能为空!",vbOKOnly + vbExclamation,"警告"
PassWord.Text = ""
confirmPWD = ""
PassWord.SetFocus
Else SQL = "insert into UserInfo (UserID,UserPWD) values('" & UserName
SQL = SQL & "','" & PassWord & "')"
TransactSQL (SQL)
MsgBox "添加成功!",vbOKOnly + vbExclamation,"添加结果"
UserName.Text = ""
PassWord.Text = ""
confirmPWD.Text = ""
UserName.SetFocus
End If
End If
End If
End Sub
Private Sub cmdOK_Click()
Dim SQL As String
Dim rs As ADODB.Recordset
本人VB水平太差.

英语翻译Private Sub cmdOK_Click()Dim SQL As StringDim rs As ADODB.RecordsetIf Trim(UserName.Text) = "" Then MsgBox "请输入用户名称!",vbOKOnly + vbExclamation,"警告"Exit SubUserName.SetFocusElseSQL = "select * from UserInfo where UserID='
这是一个注册用户的VB小程序.很简单的.我都不知道该怎么解释.Private Sub cmdOK_Click() Dim SQL As String Dim rs As ADODB.Recordset ’以下是判断输入的用户名是否为空,是的话就弹出只有确定的警告窗口.If Trim(UserName.Text) = "" Then MsgBox "请输入用户名称!",vbOKOnly + vbExclamation,"警告" Exit Sub '用户名输入框重获焦点 UserName.SetFocus ’如不为空,则在表UserInfo查询名 UserName 的记录 Else SQL = "select * from UserInfo where UserID='" & UserName & "'" Set rs = TransactSQL(SQL) '如果 rs.EOF = False 即找到相同的用户名,并弹出用户名已存在警告框.If rs.EOF = False Then MsgBox "这个用户已经存在!请重新输入用户名称!",vbOKOnly + vbExclamation,"警告" ’重获焦点并清空输入的内容 UserName.SetFocus UserName.Text = "" PassWord.Text = "" confirmPWD.Text = "" Exit Sub Else ’判断密码是否为空、两次密码输入是否一致.If Trim(PassWord.Text) Trim(confirmPWD.Text) Then MsgBox "两次输入的密码不一致,请重新输入密码!",vbOKOnly + vbExclamation,"警告" PassWord.Text = "" confirmPWD.Text = "" PassWord.SetFocus Exit Sub ElseIf Trim(PassWord.Text) = "" Then MsgBox "密码不能为空!",vbOKOnly + vbExclamation,"警告" PassWord.Text = "" confirmPWD = "" PassWord.SetFocus ’若一致则,执行SQL语句吧记录写入数据库,并弹出添加成功警告窗,并清空各输入栏,以便下次输入.Else SQL = "insert into UserInfo (UserID,UserPWD) values('" & UserName SQL = SQL & "','" & PassWord & "')" TransactSQL (SQL) MsgBox "添加成功!",vbOKOnly + vbExclamation,"添加结果" UserName.Text = "" PassWord.Text = "" confirmPWD.Text = "" UserName.SetFocus End If End If End If End Sub