vb保存到数据库出错,请大侠救救
代码如下:Private Sub Command1_Click()
Dim connectionstring As String
Adodc1.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\khzl.mdb;Persist Security Info=False" '设置数据库路径
= adCmdTable '设置记录源
Adodc1.RecordSource = "select * from 客户资料表" '连接数据库的message表文件
If Command1.Caption = "添加" Then
Command1.Caption = "保存"
Text1.SetFocus
Text1.Text = ""
Else
Adodc1.Recordset.AddNew '添加新纪录
Adodc1.Recordset("房间编号").Value = Text1.Text
Adodc1.Recordset.Update '保存
Adodc1.Refresh '刷新
MsgBox "客户资料已保存至数据库!", 64, "客户资料输入"
End If
End Sub
点【添加】输入数据后,再点【保存】,出现提示,
实时错误 '-2147217842 (80040e4e)':
操作已被取消,
点调试,错误定位在Adodc1.Recordset.AddNew '添加新纪录上,
请问各位大哥,这是怎么回事啊?