Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.CommandPrivate Sub cmdqueding_Click()
Dim strSql As String
strSql = "insert into 用户信息表(id,password,name,memo) values ('" & txtid.Text & "','" & txtmima.Text & "','" & txtname.Text & "','" & txtbeizhu.Text & "') "
  
 rst.MoveFirst
 rst.Find "id='" & txtid.Text & "'"
 On Error GoTo myerr
 
 If rst.EOF = False Then
     MsgBox "用户名存在,请选择别的用户名!", vbExclamation + vbOKOnly
       txtid.Text = ""
       txtid.SetFocus
    Else
       If txtmima.Text <> txtqueren.Text Then
          MsgBox "密码和确认密码不一样,重新输入.", vbExclamation + vbOKOnly
            txtmima.Text = ""
            txtqueren.Text = ""
            txtmima.SetFocus
        Else
 cmd.CommandText = strSql    错误 这里   程序运行到这里就停止了  
 cmd.Execute
     If MsgBox("添加成功", vbOKOnly) = vbOK Then
     FrmAddyh.Hide
     End If
     
  End If
End If
Exit Sub
myerr:
End SubPrivate Sub Form_Load()Set cnn = New ADODB.Connection
cnn.ConnectionString = "filedsn=personnel.dsn;uid=sa;pwd=sa"
cnn.Open
Set rst = New ADODB.Recordset
rst.ActiveConnection = cnn
rst.Source = "用户信息表"
rst.CursorType = adOpenDynamic
rst.Open
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
End SubPrivate Sub Form_Resize()
Me.Width = 5000
Me.Height = 7000
End Sub