首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

“实时异常‘-2147217904(80040e10)':至少一个参数没有被指定值”

2012-10-18 
“实时错误‘-2147217904(80040e10):至少一个参数没有被指定值”Private Sub cmdPlanOK_Click()Dim UserPlan

“实时错误‘-2147217904(80040e10)':至少一个参数没有被指定值”
Private Sub cmdPlanOK_Click()
  Dim UserPlan As New ADODB.Recordset
  Dim DBstr As String
  Dim Licese As String
  Dim PlanNum As Integer
  Dim SqlStr As String
  Dim Remarks As String
   
  If Me.txtLicesePlate.Text = "" Then
  MsgBox "请输入车牌号码!"
  Exit Sub
  ElseIf Len(Trim(Me.txtLicesePlate.Text)) > 9 Then
  MsgBox "车牌号码过长!"
  Exit Sub
  End If
  Licese = Replace(Trim(Me.txtLicesePlate.Text), "'", "''")
   
  If Me.txtPlanNumber.Text = "" Then
  MsgBox "请选择或者输入计划块数!"
  Exit Sub
  End If
  PlanNum = Val(Me.txtLicesePlate.Text)
  Remarks = Replace(Trim(Me.txtRemarks.Text), "'", "''")
   
  '打开数据库
  DBstr = "select * from 待生产牌照 where 车牌号码 = '" & Licese & "'"
  UserPlan.Open DBstr, DBCnn, adOpenForwardOnly, adLockOptimistic
  If Not UserPlan.BOF Then
  MsgBox "该计划已经存在!"
  UserPlan.Close
  Exit Sub
  End If
  UserPlan.Close
   
  '操作数据库添加记录
  SqlStr = "Insert Into 待生产牌照 (车牌号码,计划块数,计划日期,发出计划者,备注)" & _
  "values('" & Licese & "','" & PlanNum & "','" & Now & "','" & UserCurrent & "'," & Remarks & ");"
  DBCnn.Execute SqlStr
  MsgBox "添加成功!"

  '清空
  Me.txtLicesePlate.Text = ""
  Me.txtPlanNumber.Text = ""
  Me.txtRemarks.Text = ""
   
  AddRec (4) '记录操作
   
End Sub


“实时错误‘-2147217904(80040e10)':至少一个参数没有被指定值”怎么解决啊?我就是想把当前时间记录入数据库,在Now的位置老是出问题,现在改成这样就出现上面的错误。

[解决办法]
SqlStr = "Insert Into 待生产牌照 (车牌号码,计划块数,计划日期,发出计划者,备注) " & _
" values('" & Licese & "','" & PlanNum & "','" & format(Now(),"YYYY-MM-DD HH:MM:SS") & "','" & UserCurrent & "'," & Remarks & ")"

热点排行