VB错误提示至少一个参数没有被指定值什么原因呢?
PrivateSubCommand1_Click()DimiAsStringDimsql1,sql2,sql3AsStringDimy,wAsIntegercnn.Ope...
Private Sub Command1_Click()
Dim i As String
Dim sql1, sql2, sql3 As String
Dim y, w As Integer
cnn.Open
i = MsgBox("是否保存此条记录?", vbYesNo + vbOKOnly)
If i = vbYes Then
sql1 = "update tb_jcsb set 应还日期='" & DT1 & "'where (tb_jcsb.设备名称='" & Text1.Text & "' and tb_jcsb.借用人='" & Text3.Text & "' and tb_jcsb.借出日期=" & Chr(35) & Text2 & Chr(35) & " and tb_jcsb.应还日期=" & Chr(35) & DT1 & Chr(35) & ")"
sql2 = "update tb_jcsb set 借出数量='" & Text4 & "'where (tb_jcsb.设备名称='" & Text1.Text & "' and tb_jcsb.借用人='" & Text3.Text & "' and tb_jcsb.借出日期=" & Chr(35) & Text2 & Chr(35) & " and tb_jcsb.应还日期=" & Chr(35) & DT1 & Chr(35) & ")"
cnn.Execute (sql1)
cnn.Execute (sql2)
y = Val(Text4.Text)
w = z - y + x
sql3 = "update tb_cxsb set 可借数量='" & w & "'where (tb_jcsb.设备名称='" & Text1.Text & "')"
cnn.Execute (sql3) →(在这里提示至少一个参数没有被指定值)
MsgBox "保存成功!", vbInformation
End If
Adodc1.Refresh
Adodc2.Refresh
cnn.Close
End Sub
里面的x,y,z,w都定义过。在上边箭头那儿提示至少一个参数没有被指定值。求解。%>_<% 展开
Dim i As String
Dim sql1, sql2, sql3 As String
Dim y, w As Integer
cnn.Open
i = MsgBox("是否保存此条记录?", vbYesNo + vbOKOnly)
If i = vbYes Then
sql1 = "update tb_jcsb set 应还日期='" & DT1 & "'where (tb_jcsb.设备名称='" & Text1.Text & "' and tb_jcsb.借用人='" & Text3.Text & "' and tb_jcsb.借出日期=" & Chr(35) & Text2 & Chr(35) & " and tb_jcsb.应还日期=" & Chr(35) & DT1 & Chr(35) & ")"
sql2 = "update tb_jcsb set 借出数量='" & Text4 & "'where (tb_jcsb.设备名称='" & Text1.Text & "' and tb_jcsb.借用人='" & Text3.Text & "' and tb_jcsb.借出日期=" & Chr(35) & Text2 & Chr(35) & " and tb_jcsb.应还日期=" & Chr(35) & DT1 & Chr(35) & ")"
cnn.Execute (sql1)
cnn.Execute (sql2)
y = Val(Text4.Text)
w = z - y + x
sql3 = "update tb_cxsb set 可借数量='" & w & "'where (tb_jcsb.设备名称='" & Text1.Text & "')"
cnn.Execute (sql3) →(在这里提示至少一个参数没有被指定值)
MsgBox "保存成功!", vbInformation
End If
Adodc1.Refresh
Adodc2.Refresh
cnn.Close
End Sub
里面的x,y,z,w都定义过。在上边箭头那儿提示至少一个参数没有被指定值。求解。%>_<% 展开
1个回答
展开全部
where 前面要有空格!
语句中字段“可借数量”是文本类型吗?
如果是的话:
sql3 = "update tb_cxsb set 可借数量='" & w & "' where (tb_jcsb.设备名称='" & Text1.Text & "')"
如果不是的话,不需要加单引号
sql3 = "update tb_cxsb set 可借数量=" & w & " where (tb_jcsb.设备名称='" & Text1.Text & "')"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询