Private Sub Command3_Click()
Adodc1.Recordset.Fields("CustomerID") = Trim(Text1.Text)
Adodc1.Recordset.Fields("CardId") = Trim(Text2.Text)
Adodc1.Recordset.Fields("IdentityCard") = Trim(Text3.Text)
Adodc1.Recordset.Fields("CName") = Trim(Text4.Text)
Adodc1.Recordset.Fields("Sex") = Trim(Text5.Text)
Adodc1.Recordset.Fields("Age") = Trim(Text6.Text)
Adodc1.Recordset.Fields("Address") = Trim(Text7.Text)
Adodc1.Recordset.Fields("Postcode") = Trim(Text8.Text)
Adodc1.Recordset.Fields("Tel") = Trim(Text9.Text)
If Command3.Caption = "保存" Then
MsgBox "保存成功"
Command3.Caption = "更新"
Else
MsgBox "成功更新"
End If
Adodc1.Recordset.Update
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = False
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.CancelUpdate
Command1.Enabled = True
Command2.Enabled = True
Command4.Enabled = False
Command3.Caption = "更新"
End Sub
这个为顾客查找界面,部分代码如下:
Private Sub Command1_Click()
Dim addr As String
Dim sql As String
sql = "select * from Table_Customer where address="
addr = DataCombo1.Text
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = sql + "'" + addr + "'"
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
End Sub
Private Sub Command2_Click()
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "Table_Customer"
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
End Sub
Private Sub Form_Load()
Adodc1.Recordset.MoveFirst
DataCombo1.Text = Adodc1.Recordset.Fields("address")
End Sub
会员卡管理界面
部分代码如下:
Private Sub Command1_Click()
DataGrid1.Enabled = True
DataGrid1.AllowAddNew = True
DataGrid1.AllowUpdate = True
End Sub
Private Sub Command2_Click()
DataGrid1.Enabled = True
DataGrid1.AllowDelete = True
End Sub
Private Sub Command3_Click()
DataGrid1.Enabled = True
DataGrid1.AllowUpdate = True
End Sub
Private Sub Command5_Click()
DataGrid1.AllowAddNew = True
End Sub
商品信息界面
DataGrid1的相关属性设置:
Allowaddnew=true
Allowarrows= true
Allowdelete=true
Allowupdate=true
Datasource=adodc1
销售人员信息界面