【问题标题】:Run-time error '3061'. Too few parameters. Expected 1 [duplicate]运行时错误“3061”。参数太少。预计 1 [重复]
【发布时间】:2016-02-17 23:43:58
【问题描述】:

我在 Microsoft Access 2010 有以下 vb 语句

CurrentDb.Execute "INSERT INTO Table3(Names,ID, center, village, association , BOD ) " & _
  " VALUES(" & Me.fullnametxt & ",'" & Me.worktxt & "','" & _
  Me.Combo39 & "','" & Me.assoctxt & "','" & Me.datetraintxt & "','" & Me.datetraintxt & "')"

它生成

运行时错误“3061”。参数太少。预计 1。

【问题讨论】:

  • 再仔细看看你的字符串,我会检查你的'在哪里。我还将研究参数以帮助防止 SQL 注入...它还可以防止像您现在遇到的错误 :)

标签: database vb.net ms-access


【解决方案1】:

你错过了一些报价:

CurrentDb.Execute "INSERT INTO Table3 ( Names, ID, center, village, association , BOD ) " & _
  " VALUES ('" & Me.fullnametxt & "','" & Me.worktxt & "','" & _
  Me.Combo39 & "','" & Me.assoctxt & "','" & Me.datetraintxt & "','" & Me.datetraintxt & "')"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多