End With End Sub
Private Sub Command4_Click()
Dim conn As New ADODB.Connection Dim str As New ADODB.Recordset
conn.Open \Security=SSPI;Persist Security Info=False;Initial Catalog=德克士餐饮信息管理系统;Data Source=PC-20140228RMFY\ Set str = New ADODB.Recordset Dim strSql As String
strSql = \* from 职员 where 职员编号='\& Trim$(Text1.Text) & \or 姓名='\& Trim$(Text2.Text) & \
Set str = New ADODB.Recordset str.CursorLocation = adUseClient
str.Open strSql, conn, adOpenStatic, adLockReadOnly
conn.Execute \from 职员 where 职员编号='\& Trim$(Text1.Text) & \or 姓名='\& Trim$(Text2.Text) & \
If MsgBox(\是否删除该信息?\确认\MsgBox \已删除\提示信息\Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh End If End Sub
Private Sub Command5_Click() Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh End Sub
Private Sub Command6_Click() Load 主页 主页.Show Unload Me End Sub
Private Sub DataGrid1_Click() Adodc1.Visible = False
Adodc1.RecordSource = \职员 \Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1.Recordset DataGrid1.Refresh End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date) End Sub
17
3.5食品信息管理
3.5.1食品信息管理界面设计
3.5.2 代码
Private Sub Command1_Click()
Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim SqlStr As String
conn.Open \Security=SSPI;Persist Security Info=False;Initial Catalog=德克士餐饮信息管理系统;Data Source=PC-20140228RMFY\
SqlStr = \* from 食品 where 食品编号='\& Trim$(Text1.Text) & \名称='\& Trim$(Text2.Text) & \
rst.CursorLocation = adUseClient
rst.Open SqlStr, conn, adOpenDynamic, adLockOptimistic, adCmdText '打开记录集 Set DataGrid1.DataSource = rst '给DataGrid修改数据源 End Sub
Private Sub Command2_Click()
Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim strSql As String
strSql = \* from 食品 where 食品编号='\& Trim$(Text1.Text) & \and 名称='\& Trim$(Text2.Text) & \
conn.Open \Security=SSPI;Persist Security Info=False;Initial Catalog=德克士餐饮信息管理系统;Data Source=PC-20140228RMFY\Dim str As New ADODB.Recordset Set str = New ADODB.Recordset str.CursorLocation = adUseClient
18
str.Open strSql, conn, adOpenStatic, adLockReadOnly
With str
If .State = adStateOpen Then .Close .Open strSql If .EOF Then
conn.Execute \食品 set 名称='\& Text2.Text & \属性='\& Text3.Text & \单价='\& Text4.Text & \折扣='\保质期='\MsgBox \修改成功!\提示\Else
MsgBox \对不起,该信息已存在,请重新修改!\警告\Text1.Text = \End If
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh Text1.SetFocus End With End Sub
Private Sub Command3_Click()
Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim strSql As String
strSql = \* from 食品 where 食品编号='\& Trim$(Text1.Text) & \and 名称='\& Trim$(Text2.Text) & \
conn.Open \Security=SSPI;Persist Security Info=False;Initial Catalog=德克士餐饮信息管理系统;Data Source=PC-20140228RMFY\Dim str As New ADODB.Recordset Set str = New ADODB.Recordset str.CursorLocation = adUseClient
str.Open strSql, conn, adOpenStatic, adLockReadOnly
With str
If .State = adStateOpen Then .Close .Open strSql If .EOF Then
conn.Execute \食品 values ('\& Text4.Text & \MsgBox \添加成功!\提示信息\Else
MsgBox \对不起,该信息已存在,请重新添加!\警告\Text1.Text = \End If
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh Text1.SetFocus End With End Sub
Private Sub Command4_Click()
Dim conn As New ADODB.Connection
19
Dim str As New ADODB.Recordset
conn.Open \Security=SSPI;Persist Security Info=False;Initial Catalog=德克士餐饮信息管理系统;Data Source=PC-20140228RMFY\ Set str = New ADODB.Recordset Dim strSql As String
strSql = \* from 食品 where 食品编号='\& Trim$(Text1.Text) & \or 名称='\& Trim$(Text2.Text) & \
Set str = New ADODB.Recordset str.CursorLocation = adUseClient
str.Open strSql, conn, adOpenStatic, adLockReadOnly
conn.Execute \from 食品 where 食品编号='\& Trim$(Text1.Text) & \or 名称='\& Trim$(Text2.Text) & \
If MsgBox(\是否删除该信息?\确认\MsgBox \已删除\提示信息\Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh End If
End Sub
Private Sub Command5_Click() Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1 DataGrid1.Refresh End Sub
Private Sub Command6_Click() Load 主页 主页.Show Unload Me End Sub
3.6辅助工具管理
3.6.1辅助工具管理界面设计
20
3.6.2 代码
Private Sub word_Click()
Shell \End Sub
Private Sub calculator_Click() Shell \End Sub
Private Sub picture_Click()
Shell \
End Sub
21