主题:[原创]没有为命令对象设置命令
Private Sub Command1_Click()
Dim ADOrs As New Recordset
Dim strXB As String
Dim strsql As String
ADOrs.ActiveConnection = ADOcn
ADOrs.Open "select XH from 学生 where XH='" + Text1 + "'"
If Not ADOrs.EOF Then
MsgBox "该学号已经存在,不能增加!", vbCritical + vbOKOnly, "信息提示"
Else
If Option1.Value Then
strXB = "男"
Else
strXB = "女"
End If
stesql = "insert into 学生(XH,XM,XB)"
stesql = stesql + " values('" + Text1 + "','"
stesql = stesql + Text2 + "','" + strXB + "')"
[color=FF0000]ADOcn.Execute strsql[/color]
MsgBox "已添加新纪录!", vbOKOnly, "信息提示"
End If
End Sub
这是我编写程序的代码 运行老出现“没有为命令对象设置命令” 还清各位高手帮忙解决啊
Dim ADOrs As New Recordset
Dim strXB As String
Dim strsql As String
ADOrs.ActiveConnection = ADOcn
ADOrs.Open "select XH from 学生 where XH='" + Text1 + "'"
If Not ADOrs.EOF Then
MsgBox "该学号已经存在,不能增加!", vbCritical + vbOKOnly, "信息提示"
Else
If Option1.Value Then
strXB = "男"
Else
strXB = "女"
End If
stesql = "insert into 学生(XH,XM,XB)"
stesql = stesql + " values('" + Text1 + "','"
stesql = stesql + Text2 + "','" + strXB + "')"
[color=FF0000]ADOcn.Execute strsql[/color]
MsgBox "已添加新纪录!", vbOKOnly, "信息提示"
End If
End Sub
这是我编写程序的代码 运行老出现“没有为命令对象设置命令” 还清各位高手帮忙解决啊