VB adodc1 至少有一个参数没被指定值
对数据库的一个添加操作,想先查询表里的仓库代号不能重复,但一直出现这个问题调试了半天,也没头绪,望高手指点,谢谢PrivateSubCommand5_Click()IfT...
对数据库的一个添加操作,想先查询表里的仓库代号不能重复,但一直出现这个问题
调试了半天,也没头绪,望高手指点,谢谢
Private Sub Command5_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "库位号ID、库号和位号均不能为空!", , "错误提醒!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Exit Sub
End If
Dim name As String
Dim names As String
name = Text1.Text
names = "select * from 库位信息表 where 仓库代号='" & name & "'" 不知道是查询语句出错,但检查半 天也没找到
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = names
Adodc1.Refresh //一直在说这里出错
If Adodc1.Recordset.EOF = False Then
MsgBox "已存在相同的仓库代号!", , "错误提醒!"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("库位代号") = Text1.Text
Adodc1.Recordset.Fields("仓库号") = Text2.Text
Adodc1.Recordset.Fields("位号") = Text3.Text
Adodc1.Recordset.Fields("库位描述") = Text4.Text
Adodc1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Frame1.Visible = False
End If
End Sub 展开
调试了半天,也没头绪,望高手指点,谢谢
Private Sub Command5_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "库位号ID、库号和位号均不能为空!", , "错误提醒!"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
Exit Sub
End If
Dim name As String
Dim names As String
name = Text1.Text
names = "select * from 库位信息表 where 仓库代号='" & name & "'" 不知道是查询语句出错,但检查半 天也没找到
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = names
Adodc1.Refresh //一直在说这里出错
If Adodc1.Recordset.EOF = False Then
MsgBox "已存在相同的仓库代号!", , "错误提醒!"
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("库位代号") = Text1.Text
Adodc1.Recordset.Fields("仓库号") = Text2.Text
Adodc1.Recordset.Fields("位号") = Text3.Text
Adodc1.Recordset.Fields("库位描述") = Text4.Text
Adodc1.Recordset.Update
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Frame1.Visible = False
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询