Formclass2.frm
上传用户:bubble
上传日期:2007-03-02
资源大小:403k
文件大小:14k
- VERSION 5.00
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form Formclass2
- BorderStyle = 1 'Fixed Single
- Caption = "浏览班级"
- ClientHeight = 5730
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 11910
- Icon = "Formclass2.frx":0000
- LinkTopic = "Form2"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 5730
- ScaleWidth = 11910
- Begin VB.Frame Frame2
- Height = 5655
- Left = 3120
- TabIndex = 4
- Top = 0
- Width = 8655
- Begin MSFlexGridLib.MSFlexGrid MSF1
- Height = 5295
- Left = 120
- TabIndex = 5
- Top = 240
- Width = 8445
- _ExtentX = 14896
- _ExtentY = 9340
- _Version = 393216
- Cols = 1
- BackColor = -2147483624
- BackColorFixed = 12632256
- ForeColorFixed = 0
- BackColorSel = 16777215
- ForeColorSel = 255
- BackColorBkg = -2147483624
- AllowBigSelection= -1 'True
- SelectionMode = 1
- AllowUserResizing= 3
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin MSComctlLib.ImageList ImageList2
- Left = -120
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 2
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":0442
- Key = "class"
- Object.Tag = "class"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":0772
- Key = "cla2"
- EndProperty
- EndProperty
- End
- End
- Begin VB.Frame Frame1
- Caption = "浏览数据"
- Height = 4695
- Left = 0
- TabIndex = 2
- Top = 960
- Width = 3015
- Begin MSComctlLib.TreeView TreeView1
- Height = 4335
- Left = 120
- TabIndex = 3
- Top = 240
- Width = 2775
- _ExtentX = 4895
- _ExtentY = 7646
- _Version = 393217
- HideSelection = 0 'False
- LineStyle = 1
- Style = 7
- HotTracking = -1 'True
- ImageList = "ImageList2"
- Appearance = 1
- End
- End
- Begin VB.Frame Frame3
- Height = 940
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 3040
- Begin MSComctlLib.Toolbar Toolbar1
- Height = 765
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 2895
- _ExtentX = 5106
- _ExtentY = 1349
- ButtonWidth = 1032
- ButtonHeight = 1349
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 7
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查找"
- Key = "find"
- Object.Tag = "find"
- ImageKey = "find"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modi"
- Object.Tag = "modi"
- ImageKey = "modi"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "del"
- Object.Tag = "del"
- ImageKey = "del"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "print"
- Object.Tag = "print"
- ImageKey = "print"
- Style = 5
- BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
- NumButtonMenus = 2
- BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "dang"
- Text = "打印当前记录"
- EndProperty
- BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "all"
- Text = "打印全部记录"
- EndProperty
- EndProperty
- EndProperty
- EndProperty
- End
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 2880
- Top = 2400
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 5
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":0BC6
- Key = "del"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":101E
- Key = "print"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":169A
- Key = "find"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":1AEE
- Key = "modi"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "Formclass2.frx":1F42
- Key = "class"
- Object.Tag = "class"
- EndProperty
- EndProperty
- End
- End
- Attribute VB_Name = "Formclass2"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public printstr As String
- Public Sub classshowtitle()
- Dim i As Integer
- MSF1.Clear
- With MSF1
- .Cols = 8
- .TextMatrix(0, 1) = "年级"
- .TextMatrix(0, 2) = "班级"
- .TextMatrix(0, 3) = "教室"
- .TextMatrix(0, 4) = "年制"
- .TextMatrix(0, 5) = "专业"
- .TextMatrix(0, 6) = "班主任"
- .TextMatrix(0, 7) = "备注"
- .ColWidth(0) = 100
- .ColWidth(1) = 1300
- .ColWidth(2) = 1200
- .ColWidth(3) = 800
- .ColWidth(4) = 800
- .ColWidth(5) = 800
- .ColWidth(6) = 800
- .ColWidth(7) = 5000
-
- .FixedRows = 1
- For i = 1 To 7
- .ColAlignment(i) = 0
- Next i
- .FillStyle = flexFillSingle
- .Col = 0
- .Row = 0
- .RowSel = 1
- .ColSel = .Cols - 1
- .CellAlignment = 4
- .Row = 1
- End With
- End Sub
- Public Sub classshowdata()
- Dim j As Integer
- Dim i As Integer
- Dim mrc1 As ADODB.Recordset
- Set mrc1 = ExecuteSQL(Trim(txtsql))
- If mrc1.EOF = False Then
- mrc1.MoveFirst
- With MSF1
- .Rows = 1
- Do While Not mrc1.EOF
- .Rows = .Rows + 1
- For i = 1 To mrc1.Fields.Count
- .TextMatrix(.Rows - 1, i) = mrc1.Fields(i - 1)
- Next i
- mrc1.MoveNext
- Loop
- mrc1.Close
- End With
- Else
- If classfind = True Then
- Formclass2.Hide
- Formclass3.Show
- zzz = MsgBox("对不起,没有此班级的档案记录!", vbOKOnly, "查询")
- Formclass3.ZOrder (0)
- Formclass3.Text1(0).SetFocus
- End If
- End If
- End Sub
- Private Sub Form_Activate()
- If classfind = True Then
- Formclass3.ZOrder 0
- End If
- If classfind = True Then
- Exit Sub
- ElseIf classmodi = True Then
- classshowdata
- ' TreeView1_DblClick
- classmodi = False
- Else
- classtree
- End If
- 'If classfind = True Then
- ' Exit Sub
- 'Else
- ' MDIForm1.clabrowse
- 'End If
- End Sub
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Tag
- Case "find"
- Formclass3.Show
- Case "modi"
- If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
- sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
- Exit Sub
- Else
- qxstr = Executeqx(2)
- If qxstr = "readonly" Then
- ss = MsgBox("对不起,你是只读用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
- Exit Sub
- End If
- classmodi = True
- Formclass1.Show
- Formclass1.classload
- Formclass1.ZOrder 0
- End If
- Case "del"
- qxstr = Executeqx(2)
- If qxstr = "readonly" Then
- ss = MsgBox("对不起,你是只读用户不能删除记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
- Exit Sub
- End If
- Dim mrc As ADODB.Recordset
- Dim msgtext As String
- Dim intcount As Integer
- If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
- sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
- Exit Sub
- End If
- If MsgBox("确定要删除班级为 " & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & " 的记录吗?" & Chr(13) & Chr(10) & "继续会导致该班级在成绩和学费记录的数据丢失,继续吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
- txtsql = "delete * from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "'"
- Set mrc = ExecuteSQL(txtsql)
- txtsql = "select * from jf where 学号 in (select from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "')"
- Set mrc = ExecuteSQL(txtsql) '删除在交费表中的所有该班级的记录
- txtsql = "select * from cj where 学号 in (select from xj where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "')"
- Set mrc = ExecuteSQL(txtsql) '删除在成绩表中的所有该班级的记录
- txtsql = "delete * from class where 班级='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & "'"
- Set mrc = ExecuteSQL(txtsql) '删除该班级的记录
- End If
-
- 'txtsql = "select* from class "
- classshowtitle
- classshowdata
- End Select
- End Sub
- Public Sub classtree()
- TreeView1.Nodes.Clear
- Dim nodex As Node
- Dim mrc As ADODB.Recordset
- Dim mrc1 As ADODB.Recordset
- Dim str As String
- Dim a As String
- a = "年级"
- TreeView1.LineStyle = tvwRootLines
- str = "select distinct 年级 from class order by 年级"
- Set mrc = ExecuteSQL(str)
- str = "select distinct 年级,班级 from class order by 年级,班级"
- Set mrc1 = ExecuteSQL(str)
- mrc.MoveFirst
- Do Until mrc.EOF
- mrc1.MoveFirst
- Set nodex = TreeView1.Nodes.add(, , a, mrc.Fields(0), 1, 1)
- Do While Not mrc1.EOF
- If mrc1.Fields(0) = mrc.Fields(0) Then
- Set nodex = TreeView1.Nodes.add(a, tvwChild, , mrc1.Fields(1), 2, 2)
- End If
- mrc1.MoveNext
- Loop
- a = a & "1"
- mrc.MoveNext
- Loop
- mrc1.Close
- mrc.Close
- Set mrc = Nothing
- Set mrc1 = Nothing
- End Sub
- Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
- Select Case ButtonMenu.Key
- Case "dang"
- If Trim(printstr) = "" Then
- sssss = MsgBox("没有当前记录!", vbOKOnly + vbExclamation, "警告")
- Exit Sub
- End If
- If DataEnv1.rsCommand2.State = adStateOpen Then
- DataEnv1.rsCommand2.Close
- End If
- DataEnv1.rsCommand2.Open printstr
- If DataEnv1.rsCommand2.EOF = True Then
- sssss = MsgBox("没有当前记录!", vbOKOnly + vbExclamation, "警告")
- Exit Sub
- End If
- DataReportclass2.Show 1
- Case "all"
- If DataEnv1.rsCommand2.State = adStateOpen Then
- DataEnv1.rsCommand2.Close
- End If
- DataEnv1.rsCommand2.Open ("select * from class")
- If DataEnv1.rsCommand2.EOF = True Then
- sssss = MsgBox("没有当前记录!", vbOKOnly + vbExclamation, "警告")
- Exit Sub
- End If
- DataReportclass2.Show 1
- End Select
- End Sub
- Private Sub TreeView1_DblClick()
- On Error GoTo ss
- If TreeView1.SelectedItem.Index = 0 Then
- MSF1.Clear
- Exit Sub
- End If
- txtsql = TreeView1.Nodes.Item(TreeView1.SelectedItem.Index)
- txtsql = " select * from class where 年级='" & Trim(txtsql) & "' or 班级='" & Trim(txtsql) & "' order by 年级 ,班级 "
- printstr = txtsql
- Me.Caption = "浏览班级"
- Me.classshowtitle
- Me.classshowdata
- Exit Sub
- ss:
- MSF1.Clear
- End Sub