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

📄 frmdatacount.frm

📁 这是一个选课系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
   Begin VB.Image imgWindowBottomRight 
      Height          =   450
      Left            =   1080
      Picture         =   "frmdatacount.frx":1816
      Top             =   0
      Width           =   285
   End
   Begin VB.Image imgWindowBottomLeft 
      Height          =   450
      Left            =   720
      Picture         =   "frmdatacount.frx":1F60
      Top             =   0
      Width           =   285
   End
   Begin VB.Image imgTitleMain 
      Height          =   450
      Left            =   0
      Picture         =   "frmdatacount.frx":26AA
      Stretch         =   -1  'True
      Top             =   450
      Width           =   285
   End
   Begin VB.Image imgWindowBottom 
      Height          =   450
      Left            =   360
      Picture         =   "frmdatacount.frx":2DF4
      Stretch         =   -1  'True
      Top             =   480
      Width           =   285
   End
   Begin VB.Image imgTitleRight 
      Height          =   450
      Left            =   360
      Picture         =   "frmdatacount.frx":353E
      Top             =   0
      Width           =   285
   End
   Begin VB.Image imgTitleLeft 
      Height          =   450
      Left            =   0
      Picture         =   "frmdatacount.frx":3C88
      Top             =   0
      Width           =   285
   End
   Begin VB.Image imgWindowRight 
      Height          =   450
      Left            =   720
      Picture         =   "frmdatacount.frx":43D2
      Stretch         =   -1  'True
      Top             =   480
      Width           =   285
   End
   Begin VB.Image imgWindowLeft 
      Height          =   450
      Left            =   1080
      Picture         =   "frmdatacount.frx":4B1C
      Stretch         =   -1  'True
      Top             =   480
      Width           =   285
   End
End
Attribute VB_Name = "frmdatacount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strsql As String
Dim msgtext As String
Dim rs As ADODB.Recordset

Private Sub coutncomm_Click()
  
   If Option1.Value = True Then
      
      strsql = "select s_choose.cno,course.cname,student.sspe,count(s_choose.sno) from s_choose, student, course Where s_choose.sno = student.sno And s_choose.cno = course.cno group by s_choose.cno,course.cname,student.sspe "
      Set rs = MyDB.ExecuteSQL(strsql, msgtext)
          
         With MSFlexGrid1
           .Rows = 2
           .CellAlignment = 4
           .TextMatrix(1, 1) = "课程号"
           .TextMatrix(1, 2) = "课程名"
           .TextMatrix(1, 3) = "专业"
           .TextMatrix(1, 4) = "学生数"
         
          
             Do While Not rs.EOF
          
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 1) = rs.Fields(0)
            .TextMatrix(.Rows - 1, 2) = rs.Fields(1)
            .TextMatrix(.Rows - 1, 3) = rs.Fields(2)
            .TextMatrix(.Rows - 1, 4) = rs.Fields(3)
           
            rs.MoveNext
       Loop
        End With
        rs.Close
   End If
   
  If Option2.Value = True Then
    strsql = "select s_choose.cno,course.cname,student.sgra,count(s_choose.sno) from s_choose, student, course Where s_choose.sno = student.sno And s_choose.cno = course.cno group by s_choose.cno,course.cname,student.sgra "
     Set rs = MyDB.ExecuteSQL(strsql, msgtext)
          
         With MSFlexGrid1
           .Rows = 2
           .CellAlignment = 4
           .TextMatrix(1, 1) = "课程号"
           .TextMatrix(1, 2) = "课程名"
           .TextMatrix(1, 3) = "年级"
           .TextMatrix(1, 4) = "学生数"
         
          
             Do While Not rs.EOF
          
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 1) = rs.Fields(0)
            .TextMatrix(.Rows - 1, 2) = rs.Fields(1)
            .TextMatrix(.Rows - 1, 3) = rs.Fields(2)
            .TextMatrix(.Rows - 1, 4) = rs.Fields(3)
           
            rs.MoveNext
       Loop
        End With
        rs.Close
      
  End If
  
  If Option3.Value = True Then
  
  strsql = "select s_choose.cno,course.cname,tname,count(s_choose.sno) from course,s_choose,t_choose,teacher where t_choose.cno=s_choose.cno and teacher.tno=t_choose.tno and teacher.tno=s_choose.tno and course.cno=s_choose.cno group by s_choose.cno,t_choose.cno,tname,course.cname"
   Set rs = MyDB.ExecuteSQL(strsql, msgtext)
     
     With MSFlexGrid1
           .Rows = 2
           .CellAlignment = 4
           .TextMatrix(1, 1) = "课程号"
           .TextMatrix(1, 2) = "课程名"
           .TextMatrix(1, 3) = "教师姓名"
           .TextMatrix(1, 4) = "学生人数"
         
          
    Do While Not rs.EOF
          
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 1) = rs.Fields(0)
            .TextMatrix(.Rows - 1, 2) = rs.Fields(1)
            .TextMatrix(.Rows - 1, 3) = rs.Fields(2)
            .TextMatrix(.Rows - 1, 4) = rs.Fields(3)
           
            rs.MoveNext
       Loop
        End With
        rs.Close
    End If
  
  
  If Option4.Value = True Then
   
     strsql = "select s_choose.cno,course.cname,course.cpoint,count(s_choose.sno) from s_choose, student, course Where s_choose.sno = student.sno And s_choose.cno = course.cno group by s_choose.cno,course.cname,course.cpoint "
     Set rs = MyDB.ExecuteSQL(strsql, msgtext)
          
         With MSFlexGrid1
           .Rows = 2
           .CellAlignment = 4
           .TextMatrix(1, 1) = "课程号"
           .TextMatrix(1, 2) = "课程名"
           .TextMatrix(1, 3) = "学分"
           .TextMatrix(1, 4) = "学生数"
         
          
             Do While Not rs.EOF
          
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 1) = rs.Fields(0)
            .TextMatrix(.Rows - 1, 2) = rs.Fields(1)
            .TextMatrix(.Rows - 1, 3) = rs.Fields(2)
            .TextMatrix(.Rows - 1, 4) = rs.Fields(3)
           
            rs.MoveNext
       Loop
        End With
        rs.Close
   
   End If
  
  
  
  
  
  
    
End Sub

Private Sub exitcomm_Click()
 Unload Me
End Sub


Private Sub Form_Load()
 MakeWindow Me
End Sub
Private Sub imgTitleclose_Click()
    intNumField = -2
    Unload Me
End Sub

Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub imgTitleMinimize_Click()
    Me.WindowState = 1
End Sub

Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub printcomm_click()
    Dim i As Integer, j As Integer

    Dim msgtext As String
    Dim expworkbook As Excel.Workbook
    Dim expexcel As Excel.Application
    Dim mrc As ADODB.Recordset
    Set expexcel = New Excel.Application
    expexcel.Visible = True
    expexcel.SheetsInNewWorkbook = 1
    Set expworkbook = expexcel.Workbooks.Add

     Set mrc = MyDB.ExecuteSQL(strsql, msgtext)

    On Error Resume Next
    For i = 0 To mrc.Fields.Count - 1
        expexcel.Cells(2, i + 1) = mrc.Fields(i).Name
    Next
    mrc.MoveFirst
    For j = 1 To MSFlexGrid1.Rows
        For i = 0 To mrc.Fields.Count - 1
            expexcel.Cells(j + 2, i + 1) = CStr(mrc.Fields(i))
        Next
        mrc.MoveNext
        If mrc.EOF Then Exit For
    Next
        
    Set expexcel = Nothing
End Sub

⌨️ 快捷键说明

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