Private Sub cmd2_Click() Dim res As Integer res = MsgBox("确认要删除吗?", vbExclamation + vbYesNo + vbDefaultButton2) If res = vbYes Then Adodc1.Recordset.Delete Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast End If End If End SubPrivate Sub cmd3_Click() Adodc1.Recordset.Fields("商品ID") = Trim(Text2.Text) Adodc1.Recordset.Fields("会员ID") = Trim(Text3.Text) Adodc1.Recordset.Fields("销售数量") = Trim(Text5.Text) Adodc1.Recordset.Fields("员工ID") = Trim(Text8.Text) If cmd3.Caption = "保存" Then MsgBox "保存成功" cmd3.Caption = "更新" Else MsgBox "更新成功" End If Adodc1.Recordset.Update Adodc1.Refresh cmd1.Enabled = True cmd2.Enabled = True End SubPrivate Sub cmd1_Click() Adodc1.Recordset.AddNew cmd2.Enabled = False cmd3.Caption = "保存" cmd1.Enabled = False End SubPrivate Sub Command1_Click() Me.Hide Form2.Show End SubPrivate Sub Form_Load() Adodc1.Refresh End Sub 这个是界面代码。。这里应该没问题,感觉还是sql的问题
Dim res As Integer
res = MsgBox("确认要删除吗?", vbExclamation + vbYesNo + vbDefaultButton2)
If res = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.MoveLast
End If
End If
End SubPrivate Sub cmd3_Click()
Adodc1.Recordset.Fields("商品ID") = Trim(Text2.Text)
Adodc1.Recordset.Fields("会员ID") = Trim(Text3.Text)
Adodc1.Recordset.Fields("销售数量") = Trim(Text5.Text)
Adodc1.Recordset.Fields("员工ID") = Trim(Text8.Text)
If cmd3.Caption = "保存" Then
MsgBox "保存成功"
cmd3.Caption = "更新"
Else
MsgBox "更新成功"
End If
Adodc1.Recordset.Update
Adodc1.Refresh
cmd1.Enabled = True
cmd2.Enabled = True
End SubPrivate Sub cmd1_Click()
Adodc1.Recordset.AddNew
cmd2.Enabled = False
cmd3.Caption = "保存"
cmd1.Enabled = False
End SubPrivate Sub Command1_Click()
Me.Hide
Form2.Show
End SubPrivate Sub Form_Load()
Adodc1.Refresh
End Sub
这个是界面代码。。这里应该没问题,感觉还是sql的问题
fky1989一个人???