⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form3.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form3.frx":089A
            Key             =   "print"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form3.frx":0F16
            Key             =   "find"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form3.frx":136A
            Key             =   "modi"
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form3.frx":17BE
            Key             =   "class"
            Object.Tag             =   "class"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList2 
      Left            =   3120
      Top             =   120
      _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         =   "Form3.frx":1AEE
            Key             =   "class"
            Object.Tag             =   "class"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form3.frx":1E1E
            Key             =   "cla2"
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Public Sub showtitle()
 MSF1.Clear
  Dim i As Integer
  With MSF1
    .Cols = 8
    .TextMatrix(0, 1) = "学号"
    .TextMatrix(0, 2) = "姓名"
    .TextMatrix(0, 3) = "性别"
    .TextMatrix(0, 4) = "年龄"
    .TextMatrix(0, 5) = "系别"
    .TextMatrix(0, 6) = "班级"
    .ColWidth(0) = 100
    .ColWidth(1) = 1300
    .ColWidth(2) = 1200
    .ColWidth(3) = 800
    .ColWidth(4) = 800
    .ColWidth(5) = 800
    .ColWidth(6) = 800
    .FixedRows = 1
    For i = 1 To 6
      .ColAlignment(i) = 0
    Next i
    .FillStyle = flexFillSingle
    .Col = 0
    .Row = 0
    .RowSel = 1
    .ColSel = .Cols - 1
    .CellAlignment = 4
    .Row = 1
    End With
End Sub

Private Sub Form_Activate()
If find = True Then
Form4.ZOrder
End If
If find = True Then
  Exit Sub
ElseIf modi = True Then
showdata
 ' TreeView1_DblClick
'  modi = False
Else
  tree
End If
End Sub

Public Sub showdata()
    Dim j As Integer
    Dim i As Integer
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    msql = ql()
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = msql
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = False Then
        Adodc1.Recordset.MoveFirst
        With MSF1
            .Rows = 50
            .Row = 1
            Do While Not Adodc1.Recordset.EOF
            .Rows = .Rows + 1
         For i = 1 To Adodc1.Recordset.Fields.Count
            .TextMatrix(.Row, i) = Adodc1.Recordset.Fields(i - 1)
             Next i
            .Row = .Row + 1
            Adodc1.Recordset.MoveNext
            Loop
        End With
    Else
        If find = True Then
            Form3.Hide
            Form4.Show
            MsgBox "对不起,没有此学生的档案记录!", vbInformation + vbOKOnly, "查询"
            Form4.ZOrder (0)
            Form4.Text1(0).SetFocus
        End If
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
If find = True Then
  find = False
  Form4.Text1(0).SetFocus
End If
End Sub

Public Sub tree()
    TreeView1.Nodes.Clear
    Dim nodex As Node
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    sql = "select * from student"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    Dim a As String
    a = "学号"
    TreeView1.LineStyle = tvwRootLines
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    sql = "select distinct sno from student order by sno"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    Adodc2.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    sql = "select distinct sno,name from student order by sno,name"
    Adodc2.CommandType = adCmdText
    Adodc2.RecordSource = sql
    Adodc2.Refresh
    Adodc1.Recordset.MoveFirst
    Do Until Adodc1.Recordset.EOF
    Adodc2.Recordset.MoveFirst
    Set nodex = TreeView1.Nodes.add(, , a, Adodc1.Recordset.Fields(0), 1, 1)
    Do While Not Adodc2.Recordset.EOF
    If Adodc2.Recordset.Fields(0) = Adodc1.Recordset.Fields(0) Then
       Set nodex = TreeView1.Nodes.add(a, tvwChild, , Adodc2.Recordset.Fields(1), 2, 2)
    End If
    Adodc2.Recordset.MoveNext
    Loop
    a = a & "1"
    Adodc1.Recordset.MoveNext
    Loop
    Adodc1.Recordset.Close
    Adodc2.Recordset.Close
    Adodc1.Refresh
    Adodc2.Refresh
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Tag
        Case "find"
        Form4.Show
        Case "modi"
            mqx = qx()
                If mqx = "user" Then
                    ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
                    Exit Sub
                End If
                Form5.Show
                Form5.ZOrder 0
        Case "del"
              mqx = qx()
                If mqx = "user" Then
                    ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
                    Exit Sub
                End If
                Form5.Show
                Form5.ZOrder 0
    End Select
End Sub

Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
  Select Case ButtonMenu.Key
  Case "dang"
  If Trim(printstr) = "" Then
    MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
    Exit Sub
  End If
    If DataEnv1.rsCommand1.State = adStateOpen Then
     DataEnv1.rsCommand1.Close
    End If
     DataEnv1.rsCommand1.Open printstr
     If DataEnv1.rsCommand1.EOF = True Then
         MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
      Exit Sub
    End If
    DataReportstudent.Show 1
   Case "all"
     If DataEnv1.rsCommand1.State = adStateOpen Then
     DataEnv1.rsCommand1.Close
    End If
     DataEnv1.rsCommand1.Open ("select * from student ")
     If DataEnv1.rsCommand1.EOF = True Then
           MsgBox "有当前记录!", vbOKOnly + vbExclamation, "警告"
      Exit Sub
    End If
    DataReportstudent.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
   sql = TreeView1.Nodes.Item(TreeView1.SelectedItem.Index)
   sql = "select * from student where student.sno='" & sql & "' or student.name='" & sql & "' order by student.sno ,student.name"
   printstr = sql
Me.Caption = "浏览学生档案"
Me.showtitle
Me.showdata
Exit Sub
ss:
MSF1.Clear
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -