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

📄 frmcj1.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Left            =   6600
      Top             =   120
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   "he"
      Password        =   "he"
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "frmcj1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Public Sub cjshowtitle()
 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) = "教师职称"
    .ColWidth(0) = 100
    .ColWidth(1) = 1300
    .ColWidth(2) = 1200
    .ColWidth(3) = 800
    .ColWidth(4) = 800
    .ColWidth(5) = 800
    .ColWidth(6) = 800
    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 cjshowdata()
    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 cjfind = True Then
    frmcj1.Hide
    frmcj3.Show
    MsgBox "对不起,没有该学生的成绩记录!", vbOKOnly, "查询"
    frmcj3.ZOrder (0)
    frmcj3.Text1(0).SetFocus
   End If
 End If
End Sub

Private Sub Form_Activate()
    If cjfind = True Then
        frmcj3.ZOrder 0
    End If
    If cjfind = True Then
        Exit Sub
    ElseIf cjmodi = True Then
        cjshowdata
    Else
     cjtree
    End If
End Sub


Private Sub Form_Unload(Cancel As Integer)
If cjfind = True Then
  cjfind = False
  frmcj3.Text1(0).SetFocus
End If
End Sub
Public Sub cjtree()
TreeView1.Nodes.Clear
Dim nodex As Node
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from choose"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
Dim a As String
a = "学号"
TreeView1.LineStyle = tvwRootLines
sql = "select distinct sno from choose 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,cno from choose order by sno,cno"
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
 Adodc2.Recordset.Close
 Adodc1.Recordset.Close
 Adodc1.Refresh
 Adodc2.Refresh
End Sub


Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Tag
        Case "find"
        frmcj3.Show
        Case "modi"
                mqx = qx()
                If mqx = "user" Then
                    ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
                Exit Sub
                End If
                frmcj4.Show
                frmcj4.ZOrder 0
                
        Case "del"
                mqx = qx()
                If mqx = "user" Then
                    ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
                Exit Sub
                End If
                frmcj4.Show
                frmcj4.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.rsCommand3.State = adStateOpen Then
     DataEnv1.rsCommand3.Close
    End If
     DataEnv1.rsCommand3.Open frmcj1.printstr '("select choose.sno,choose.cno,choose.grade,course.cname,course.teacher,course.profession from choose,course where choose.cno=course.cno and choose sno='" &  & "')")
     If DataEnv1.rsCommand3.EOF = True Then
        MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
      Exit Sub
    End If
    DataReportgrade.Show 1
   Case "all"
     If DataEnv1.rsCommand3.State = adStateOpen Then
     DataEnv1.rsCommand3.Close
    End If
     DataEnv1.rsCommand3.Open ("select choose.sno,choose.cno,choose.grade,course.cname,course.teacher,course.profession from choose,course where choose.cno=course.cno")
     If DataEnv1.rsCommand3.EOF = True Then
         MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
      Exit Sub
    End If
    DataReportgrade.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 choose where sno='" & Trim(sql) & "' or cno='" & Trim(sql) & "' order by sno,cno "
   printstr = sql
Me.Caption = "浏览成绩"
Me.classshowtitle
Me.classshowdata
Exit Sub
ss:
MSF1.Clear
End Sub

⌨️ 快捷键说明

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