VB中缺少标识符

Private Sub Command1_Click()
Dim sql As String
Dim rs_add As New adodb.Recordset
If Trim(Text.Text) = " " Then
MsgBox "用户名不能为空", vbOKOnly + vbExclamation, " "
Exit Sub
Text1.SetFocus
Else
sql = "select * from 系统管理"
rs_add.open sql, conn, adOpenKeyset, adlockpessimistic
While (rs_add.EOF = False)
If Trim(rs_add.fields(0)) = Trim(Text1.Text) Then
MsgBox "已有这个用户", vbOKOnly + vbExclamation, " "
Text1.SetFocus
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Combo1.Text = " "
Exit Sub
Else
rs_add.movenext
End If
Wend
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "两次密码不一致", vbOKOnly + vbExclamation, " "
Text2.SetFocus
Text2.Text = " "
Text3.Text = " "
Exit Sub
Else
If Trim(Combo1.Text) <> "system" And Trim(Combo1.Text) <> "guest" Then
MsgBox "请选择正确的用户权限", vbOKOnly + vbExclamation, " "
Combo1.SetFocus
Combo1.Text = " "
Exit Sub
Else
rs_add.addnew
rs_add.fields(0) = Text1.Text
rs_add.fields(1) = Text2.Text
rs_add.fields(2) = Combo1.Text
rs_add.Update
re_add.Close
MsgBox "添加用户成功", vbOKOnly + vbExclamation, " "
Unload Me
End If
End If
End Sub

第1个回答  2012-06-06
Dim rs_add As New adodb.Recordset
错误,Dim定义变量不能有下划线