一个FORM中,七个textbox框,当使用SELECT将值显示在textbox后,想编辑后再保存,使用update语法,如下:
Set ks1 = cnn.Execute("update sysmain set bh=" & Text1.Text & " ,dw=" & Text4.Text & " ,zw=" & Text5.Text & " ,wj=" & Text6.Text & " ,sDate=" & Text7.Text & "  ,sname=" & Text2.Text & "  where id=" & IdNum & "")
总提示“至少一个参数没有被指定值“)不知所措....

解决方案 »

  1.   

    修改如下
    字符串类型用单引号
    日期类型用#号
    Set ks1 = cnn.Execute("update sysmain set bh='" & Text1.Text & "' ,dw='" & Text4.Text & "' ,zw='" & Text5.Text & "' ,wj='" & Text6.Text & "' ,sDate=#" & Text7.Text & "#  ,sname='" & Text2.Text & "'  where id=" & IdNum  )
      

  2.   

    字符型变量引用:'"& 变量名 &"'
    数值型变量引用:"& 变量名 &"
    日期型变量引用(SQL中):'"& 变量名 &"'
    日期型变量引用(access中): "# & 变量名 & #"
      

  3.   

    Set ks1 = cnn.Execute("update sysmain set bh='" & Text1.Text & "' ,dw='" & Text4.Text & "' ,zw='" & Text5.Text & "' ,wj='" & Text6.Text & "' ,sDate=#" & Text7.Text & "# ,sname='" & Text2.Text & "' where id=" & IdNum )
      

  4.   

    注意日期在access中用#号,在sql中用'号