以下是我全部的代码,初学数据库,这个问题我网上搜了,答案好像都不行,请指点简单说明:    我用了一个Data控件,第一次运行创建一个数据库后,再屏蔽了创建的那部分代码,然后在属性栏设置了data1的数据源,textbox控件关联的字段等,再次运行后点击添加按钮,出现了“实时错误 3246 该操作被关联对象取消”
Private Sub Command1_Click()Data1.Recordset.AddNew
Data1.Recordset.UpdateEnd SubPrivate Sub Form_Load()Dim db As Database, ws As Workspace
Dim td As TableDef
Dim flds(2) As Field
Dim idx As IndexSet ws = DBEngine.Workspaces(0)
Set db = ws.CreateDatabase("D:\学习\vb\学习测试\数据库\数据库1", dbLangGeneral, dbVersion30)Set td = db.CreateTableDef("Products")Set flds(0) = td.CreateField("ProductID", dbLong)
'flds(0).Attributes = dbAutoIncrField
Set flds(1) = td.CreateField("ProductName", dbText)
flds(1).Size = 40td.Fields.Append flds(0)
td.Fields.Append flds(1)
db.TableDefs.Append tdSet idx = td.CreateIndex("Pro_ID")
idx.Primary = True
idx.Unique = TrueSet newfld = idx.CreateField("ProductName")idx.Fields.Append newfld
td.Indexes.Append idxLabel1.FontSize = 12
Label2.FontSize = 12
Label3.FontSize = 12
Command1.Caption = "添加"
Command2.Caption = "删除"
Command3.Caption = "确定"
Command4.Caption = "放弃"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.FontSize = 12
Text2.FontSize = 12
Text3.FontSize = 12
Label3.Visible = False
Text3.Visible = FalseEnd Sub