美容院管理系统论文 下载本文

图6-6 商品管理界面

2.主要代码 Dim yf%

Private Sub Command3_Click() On Error Resume Next If yf <> 0 Then

MsgBox \现在正在执行其他操作,不能进行查询!\提示\Exit Sub End If

If Combo1.Text = \

MsgBox \请选择要查询的字段!\提示\ Combo1.SetFocus Exit Sub End If

If Text2.Text = \

MsgBox \请输入要查询的条件!\提示\ Text2.SetFocus Exit Sub End If

If Combo1.Text = \商品编号\

rst.Open \商品编号='\+ \

If rst.RecordCount = 0 Then

MsgBox \没有要查询的记录!\提示\ End If rst.Close

Adodc1.RecordSource = \商品编号='\Trim(Text2.Text) + \ Adodc1.Refresh

ElseIf Combo1.Text = \商品名称\

rst.Open \商品名称='\+ \

If rst.RecordCount = 0 Then

MsgBox \没有要查询的记录!\提示\ End If rst.Close

Adodc1.RecordSource = \商品名称='\Trim(Text2.Text) + \ Adodc1.Refresh Else

MsgBox \请选择要查询的正确字段!\提示\End If End Sub

Private Sub Command4_Click()

Adodc1.RecordSource = \价格\ Adodc1.Refresh End Sub

Private Sub Command5_Click()

Adodc1.RecordSource = \用途\ Adodc1.Refresh End Sub

Private Sub Form_Load() Adodc1.ConnectionString = \Server};server=(local);database=mry\

Adodc1.RecordSource = \ Adodc1.Refresh End Sub

Private Sub Command1_Click() On Error Resume Next If yf = 1 Then '新增

rst.Open \* From shangpin\Cnn, adOpenKeyset, adLockOptimistic Call Check(\商品编号\ If Fh = 1 Then rst.Close Fh = 0 Exit Sub

End If

'----------------------------------------- rst.AddNew

For i = 0 To 6

rst.Fields(i) = Text1(i) Next i

rst.Fields(\入库时间\ rst.Update

For i = 0 To 6 Text1(i) = \ Next i yf = 0 rst.Close Adodc1.Refresh

ElseIf yf = 2 Then '修改

rst.Open \* From shangpin where 商品编号='\Trim(DataGrid1.Columns(0)) + \ For i = 0 To 6

rst.Fields(i) = Text1(i) Next i

rst.Fields(\入库时间\ rst.Update yf = 0 rst.Close

Adodc1.Refresh End If

Command1.Enabled = False Command2.Enabled = False End Sub

Private Sub Command2_Click() For i = 0 To 6 Text1(i) = \ Next i yf = 0

Command1.Enabled = False Command2.Enabled = False Frame3.Enabled = False End Sub

Private Sub DataGrid1_Click()

If yf = 1 Or yf = 2 Then Exit Sub For i = 0 To 6

Text1(i) = DataGrid1.Columns(i) Next i

+

End Sub

Private Sub Toolbar1_ButtonClick(ByVal button As MSComctlLib.button) Select Case button Case \商品入库\ For i = 0 To 6 Text1(i) = \ Next i

Text1(0).SetFocus

Command1.Enabled = True Command2.Enabled = True yf = 1 Case \退出\ Unload Me Case \编辑商品\

If Text1(0) = \

MsgBox \请选择要修改的商品\警告\ Else

Command1.Enabled = True Command2.Enabled = True Text1(0).SetFocus yf = 2 End If

Case \删除商品\If yf <> 0 Then

MsgBox \现在正在执行其他操作,不能进行删除!\提示\Exit Sub End If

On Error Resume Next

'-------------------------------------

rst.Open \商品编号='\\'------------------------------------- If Text1(0) = \

MsgBox \请选择要删除的商品\警告\ Else

i = MsgBox(\是否确定删除商品编号为“\”的商品\vbYesNo, \提示\

If i = vbYes Then rst.Delete Adodc1.Refresh For i = 0 To 6 Text1(i) = \ Next i Else