Dim i As Integer
Dim cn As ADODB.Connection
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=yuancheng;Data Source=YUANCHENG"
If Trim(Text(0).Text) = "" Then
   MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
   Text(0).SetFocus
Else
   mrc.Open "select  *  from user where yonghuming1 ='" & Trim(Text(0).Text) & "'", cn, adOpenDynamic, adLockOptimistic
   If mrc.EOF Then
     MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
     Text(0).SetFocus
   Else
     If Trim(mrc.Fields(1)) = Trim(Text(1).Text) Then
     Unload Me
       MDIForm1.Show
    Else
       MsgBox "你输入的密码不正确,请重新再输入!", vbOKOnly + vbExclamation, "警告"
       Text(1).SetFocus
       Text(1).Text = ""
      End If
   End If
End If
 i = i + 1
If i = 3 Then
MsgBox "对不起您已经三次验证错误!系统将重新启动!", vbOKOnly + vbExclamation, "警告"
 Me.Hide
End If
Exit Sub
运行时出现的错误是:在关键字“user”附近有语法错误