有个例题,只有部分代码,就是连接数据库的没给连接 ,如下
,向数据库添加数据后保存
Private Sub cmd_save_Click()
Call main
Dim c As String
If Combo100.Text = "" Then
'msbgox "部门不能为空"
Combo100.SetFocus
Else
Adodc1.RecordSource = "select * from order_list where dh='" + Text1000.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("确认要保存信息吗?", 33, "订书系统")
If c = vbOK Then
Check1.Value = 0
Dim temp
temp = "订书"
Set adors = adocon.Execute("insert into order_list values(" & Text1000 & ",'" & Combo100 & "','" & Text2000 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "')")
MsgBox "数据保存成功!", 32, "订书系统"
cmd_save.Enabled = True
cmd_add.Enabled = True
Else
End If
Else
MsgBox "对不起,该信息已保存过", 64, "订书系统"
End If
End If
Adodc1.RecordSource = "select * from order_list order by dh"
Adodc1.Refresh
adocon.Close
End Sub在窗体我按“保存”按钮,提示“变量未定义 Set adors = adocon.Execute”,我怎么连接数据库,要模块吗?该怎么连? 谢