首页 > 解决方案 > 我在 vb6 中有运行时错误“3219”,它说我的代码是“在这种情况下不允许操作”,

问题描述

不允许的代码是读取函数“pdffile.read”,我已经尝试获得偏好但不工作

Private Sub Command2_Click()
   Set rs = New ADODB.Recordset

   rs.Open "select * from tble1", cn, adOpenKeyset, adLockOptimistic
   rs.AddNew
   If pdfpath <> "" Then
      Set pdffile = New ADODB.stream
      pdffiletype = adtypebinary
      pdffile.Open
      pdffile.loadfromfile pdfpath

      rs.Fields("pdf") = pdffile.read
      rs!pdfid = txt.Text
      rs!pdfname = txtname.Text

      pdffile.Close
      Set pdffile = Nothing
      pdffile.Close
      Set pdffile = Nothing
   End If

   rs.Update
   rs.Close
   Set rs = Nothing
End Sub

标签: vb6

解决方案


推荐阅读