这段代玛Access 数据库能用在SQL中不对,请问什么原因?
Private Sub Command2_Click()Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
rs2.Open "select * from 生产指令档案 where 指令编号='" + Combo1 + "'", adoCon, adOpenKeyset, adLockOptimistic
rs1.Open "select * from 热处理传票 where 顺序号 ='" + Text10.text + "'and 指令编号='" + Combo1 + "'", adoCon, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
cnn.Execute ("insert into 生产指令传票 values ('" & Trim(rs2.Fields(0)) & "','" & rs2.Fields(1) & "','" & rs2.Fields(2) & "','" & rs2.Fields(3) & "','" & rs2.Fields(4) & "','" & rs2.Fields(5) & "','" & rs2.Fields(6) & "','" & Trim(Text10) & "')")
adoCon.Execute ("delete from 热处理传票 where 顺序号='" & Text10 & "'and 指令编号='" + Combo1 + "'")
adoCon.Execute ("delete from 热处理档案 where 顺序号='" & Text10 & "'and 指令编号='" + Combo1 + "'")
adoCon.Close
MsgBox "已删除记录"
Else
MsgBox "没有记录", 4, "管理系统"
End If
End Sub
这段代玛Access 数据库能用在SQL中不对,请问什么原因?帮帮忙
错误出在什么地方?
我已解决了,谢谢了 adoCon.Execute ("delete from 热处理传票 where 顺序号='" & Text10 & "'and 指令编号='" + Combo1 + "'")
adoCon.Execute ("delete from 热处理档案 where 顺序号='" & Text10 & "'and 指令编号='" + Combo1 + "'")
这两句and前都缺少空格。
猴哥火眼金睛啊..
补充:VB , 数据库(包含打印,安装,报表)