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

📄 form2.frm

📁 基于VB和SQL的邮件自动处理辅助教学系统原码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
      Begin VB.CommandButton Command1 
         Caption         =   "查看新邮件"
         Height          =   495
         Left            =   360
         TabIndex        =   1
         Top             =   840
         Width           =   1335
      End
      Begin VB.Label Label8 
         Caption         =   "查看"
         Height          =   375
         Left            =   2040
         TabIndex        =   24
         Top             =   3480
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "查看"
         Height          =   255
         Left            =   2040
         TabIndex        =   22
         Top             =   1920
         Width           =   495
      End
      Begin VB.Label Label7 
         Caption         =   "导出Excel文件名"
         Height          =   255
         Left            =   -74880
         TabIndex        =   21
         Top             =   4320
         Width           =   1575
      End
      Begin VB.Label Label6 
         Caption         =   "导出Excel文件名"
         Height          =   255
         Left            =   -74640
         TabIndex        =   16
         Top             =   3600
         Width           =   1455
      End
      Begin VB.Label Label5 
         Caption         =   "学生问题"
         Height          =   375
         Left            =   360
         TabIndex        =   5
         Top             =   3840
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "学生意见"
         Height          =   375
         Left            =   360
         TabIndex        =   4
         Top             =   3240
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "附件作业"
         Height          =   495
         Left            =   360
         TabIndex        =   3
         Top             =   2640
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "文本作业"
         Height          =   375
         Left            =   360
         TabIndex        =   2
         Top             =   2040
         Width           =   1215
      End
   End
   Begin ComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   495
      Left            =   0
      TabIndex        =   30
      Top             =   6405
      Width           =   8970
      _ExtentX        =   15822
      _ExtentY        =   873
      SimpleText      =   ""
      _Version        =   327682
      BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
         NumPanels       =   3
         BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Object.Width           =   4410
            MinWidth        =   4410
            Text            =   "邮件自动处理系统欢迎您"
            TextSave        =   "邮件自动处理系统欢迎您"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
         BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Style           =   6
            Alignment       =   2
            AutoSize        =   1
            Object.Width           =   8308
            TextSave        =   "2006-6-19"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
         BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Style           =   5
            Alignment       =   2
            TextSave        =   "11:19"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public db1 As New ADODB.Connection
Public rs1 As New ADODB.Recordset
Public db2 As New ADODB.Connection
Public rs2 As New ADODB.Recordset
Private Sub Command1_Click()
Form2.Hide
frmMail.Show
End Sub
Private Sub Command10_Click()
If MsgBox("确定删除?!", vbExclamation + vbYesNo, "提示信息") = vbYes Then
            rs2.Delete
    End If
End Sub
Private Sub Command11_Click()
CommonDialog1.flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "AllFiles(*.*)|*.*|Excel Files" & "(*.xls)|*.xls"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowSave
Text1.Text = CommonDialog1.FileName
If CommonDialog1.FileName = "" Then
MsgBox "请选择文件保存位置", vbOKOnly + vbExclamation, "提示"
Else
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
Set oSheet = oExcel.Application.Workbooks(1).Worksheets("Sheet1")
oSheet.Range("A1").CopyFromRecordset rs
oBook.SaveAs CommonDialog1.FileName
oExcel.Quit
End If
End Sub

Private Sub Command12_Click()
CommonDialog1.flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "AllFiles(*.*)|*.*|Excel Files" & "(*.xls)|*.xls"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowSave
Text1.Text = CommonDialog1.FileName
If CommonDialog1.FileName = "" Then
MsgBox "请选择文件保存位置", vbOKOnly + vbExclamation, "提示"
Else
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
Set oSheet = oBook.Worksheets(1)
Set oSheet = oExcel.Application.Workbooks(1).Worksheets("Sheet1")
oSheet.Range("A1").CopyFromRecordset rs
oBook.SaveAs CommonDialog1.FileName
oExcel.Quit
End If
End Sub
Private Sub Command13_Click()
Form2.Hide
Form9.Label1.Caption = Form2.Combo3.Text
Form9.Label2.Caption = "的全部" + Form2.Combo4.Text + "见下表:"
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
db1.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db1.Open
Select Case Form2.Combo4.Text
Case "文本作业"
rs1.Open "select * from 文本作业 where 学号='" & Form2.Combo4.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
Case "附件作业"
rs1.Open "select * from 附件作业 where 学号='" & Form2.Combo4.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
Case "意见"
rs1.Open "select * from 意见 where 学号='" & Form2.Combo4.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
Case "提问"
rs1.Open "select * from 提问 where 学号='" & Form2.Combo4.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
End Select
Set Form9.DataGrid1.DataSource = rs1
Form9.Caption = "查看单个学生作业"
Form9.Show
End Sub
Private Sub Command2_Click()
Form2.Hide
Form9.Label1.Caption = Form2.Combo1.Text + "的全部" + Form2.Combo2.Text + "见下表:"
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
db1.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db1.Open
Select Case Form2.Combo2.Text
Case "文本作业"
rs1.Open "select * from 文本作业 where 学号 in (select 学号 from 学生 where 班级='" & Form2.Combo1.Text & "')", db1, adOpenDynamic, adLockOptimistic, -1
Case "附件作业"
rs1.Open "select * from 附件作业 where 学号 in (select 学号 from 学生 where 班级='" & Form2.Combo1.Text & "')", db1, adOpenDynamic, adLockOptimistic, -1
Case "意见"
rs1.Open "select * from 意见 where 学号 in (select 学号 from 学生 where 班级='" & Form2.Combo1.Text & "')", db1, adOpenDynamic, adLockOptimistic, -1
Case "提问"
rs1.Open "select * from 提问 where 学号 in (select 学号 from 学生 where 班级='" & Form2.Combo1.Text & "')", db1, adOpenDynamic, adLockOptimistic, -1
End Select
Set Form9.DataGrid1.DataSource = rs1
Form9.Show
End Sub

Private Sub Command3_Click()
Form2.Hide
'Form3.Label1.Caption = Me.DataGrid1
Form3.Show
End Sub
Private Sub Command4_Click()
Form2.Hide
Form10.Show
End Sub
Private Sub Command5_Click()
On Error Resume Next
If Command5.Caption = "添加" Then
Command5.Caption = "确认"
rs2.AddNew
Else
Command5.Caption = "添加"
rs2.Update
End If
End Sub
Private Sub Command6_Click()
On Error Resume Next
If Command6.Caption = "添加" Then
Command6.Caption = "确认"
rs1.AddNew
Else
Command6.Caption = "添加"
rs1.Update
End If
End Sub
Private Sub Command7_Click()
 If MsgBox("确定删除?!", vbExclamation + vbYesNo, "提示信息") = vbYes Then
            rs1.Delete
            End If
End Sub
Private Sub Command8_Click()
On Error Resume Next
If Command8.Caption = "修改" Then
Command8.Caption = "确认"
Else
Command9.Caption = "修改"
rs2.Update
End If
End Sub
Private Sub Command9_Click()
On Error Resume Next
If Command9.Caption = "修改" Then
Command9.Caption = "确认"
Else
Command9.Caption = "修改"
rs1.Update
End If
End Sub
Private Sub DataGrid1_DblClick()
Dim i As Integer, x() As String
ReDim x(DataGrid1.Columns.Count - 1)
For i = 0 To UBound(x)
x(i) = "Colums(" & i + 1 & "): " & CStr(DataGrid1.Columns(i).Text)
Next
MsgBox Join(x, vbCrLf)
End Sub
Private Sub DataGrid2_DblClick()
Dim i As Integer, x() As String
ReDim x(DataGrid1.Columns.Count - 1)
For i = 0 To UBound(x)
x(i) = "Colums(" & i + 1 & "): " & CStr(DataGrid1.Columns(i).Text)
Next
MsgBox Join(x, vbCrLf)
End Sub
Private Sub Form_Load()
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
db1.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db1.Open
rs1.Open "select * from 学生", db1, adOpenDynamic, adLockOptimistic, -1
Set DataGrid1.DataSource = rs1
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
db1.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db1.Open
rs1.Open "select distinct 班级 from 学生", db1, adOpenDynamic, adLockOptimistic, -1
Do Until rs1.EOF
        Combo1.AddItem rs1.Fields(0)
        rs1.MoveNext
    Loop
Set db1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
rs1.CursorLocation = adUseClient
db1.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db1.Open
rs1.Open "select 学号 from 学生", db1, adOpenDynamic, adLockOptimistic, -1
Do Until rs1.EOF
        Combo3.AddItem rs1.Fields(0)
        rs1.MoveNext
    Loop
Set db2 = New ADODB.Connection
Set rs2 = New ADODB.Recordset
rs2.CursorLocation = adUseClient
db2.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db2.Open
rs2.Open "select * from 记录", db2, adOpenDynamic, adLockOptimistic, -1
Set DataGrid2.DataSource = rs2
End Sub

Private Sub Label2_Click()
Form2.Hide
Form4.Show
End Sub

Private Sub Label3_Click()
Form2.Hide
Form5.Show
End Sub

Private Sub Label4_Click()
Form2.Hide
Form6.Show
End Sub

Private Sub Label5_Click()
Form2.Hide
Form7.Show
End Sub

⌨️ 快捷键说明

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