📄 form13.frm
字号:
Begin VB.Label Label3
Caption = "年龄"
Height = 375
Left = 480
TabIndex = 6
Top = 2400
Width = 735
End
Begin VB.Label Label4
Caption = "性别"
Height = 375
Left = 480
TabIndex = 5
Top = 3240
Width = 735
End
Begin VB.Label Label5
Caption = "班级"
Height = 255
Left = 480
TabIndex = 4
Top = 3960
Width = 615
End
Begin VB.Label Label6
Caption = "邮箱"
Height = 375
Left = 480
TabIndex = 3
Top = 4680
Width = 615
End
End
End
Attribute VB_Name = "Form13"
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
Public db3 As New ADODB.Connection
Public rs3 As New ADODB.Recordset
Public db4 As New ADODB.Connection
Public rs4 As New ADODB.Recordset
Public db5 As New ADODB.Connection
Public rs5 As New ADODB.Recordset
Private Sub Combo1_Click()
Label7.Visible = True
Text10.Visible = True
Label7.Caption = "请输入日期"
Label11.Visible = True
Text3.Visible = True
If Combo1.Text = "文本作业" Then
Label9.Visible = True
Text1.Visible = True
Label9.Caption = "请输入作业序号"
Label11.Caption = "请输入作业内容"
Label10.Visible = False
Text2.Visible = False
ElseIf Combo1.Text = "附件作业" Then
Label9.Visible = True
Text1.Visible = True
Label10.Visible = True
Text2.Visible = True
Label9.Caption = "请输入作业序号"
Label10.Caption = "请输入附件号"
Label11.Caption = "请输入作业内容"
ElseIf Combo1.Text = "意见" Then
Label10.Visible = False
Text2.Visible = False
Label9.Visible = False
Text1.Visible = False
Label11.Caption = "请输入意见"
Else
Label11.Caption = "请输入问题"
Label9.Visible = False
Label10.Visible = False
Text1.Visible = False
Text2.Visible = False
End If
End Sub
Private Sub Command1_Click()
Form13.Hide
Form12.Text2.Text = ""
Form12.Show
End Sub
Private Sub Command2_Click()
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 学生 where 学号='" & Form12.Text1.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
On Error Resume Next
If Command2.Caption = "修改个人信息" Then
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Command2.Caption = "确认"
Else
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Command2.Caption = "修改个人信息"
rs1.Update
End If
End Sub
Private Sub Command3_Click()
Text11.Text = Form12.Text1.Text
If Command3.Caption = "添加" Then
Command3.Caption = "保存"
If Combo1.Text = "文本作业" Then
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
rs1.AddNew
Set Text1.DataSource = rs1
Text1.DataField = "作业序号"
Set Text11.DataSource = rs1
Text11.DataField = "学号"
Set Text10.DataSource = rs1
Text10.DataField = "日期"
Set Text3.DataSource = rs1
Text3.DataField = "作业内容"
ElseIf Combo1.Text = "附件作业" Then
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
rs1.AddNew
Set Text1.DataSource = rs1
Text1.DataField = "作业序号"
Set Text11.DataSource = rs1
Text11.DataField = "学号"
Set Text10.DataSource = rs1
Text10.DataField = "日期"
Set Text2.DataSource = rs1
Text2.DataField = "附件号"
ElseIf Combo1.Text = "意见" Then
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
rs1.AddNew
Set Text11.DataSource = rs1
Text11.DataField = "学号"
Set Text10.DataSource = rs1
Text10.DataField = "日期"
'Set Text3.DataSource = rs1
'Text3.DataField = "意见"
Else
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
rs1.AddNew
Set Text11.DataSource = rs1
Text11.DataField = "学号"
Set Text10.DataSource = rs1
Text10.DataField = "日期"
Set Text3.DataSource = rs1
Text3.DataField = "问题"
End If
ElseIf Command3.Caption = "保存" Then
Command3.Caption = "添加"
rs1.Update
Dim i As Integer
i = MsgBox("保存成功!", , "提示信息")
End If
End Sub
Private Sub Command4_Click()
Form13.Hide
Form14.Show
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 DataGrid3_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 DataGrid4_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_Activate()
Form13.Text11.Text = Form12.Text1.Text
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
DataGrid1.Enabled = False
DataGrid2.Enabled = False
DataGrid3.Enabled = False
Text11.Visible = False
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 学生 where 学号='" & Form12.Text1.Text & "'", db1, adOpenDynamic, adLockOptimistic, -1
Set Text4.DataSource = rs1
Text4.DataField = "学号"
Set Text5.DataSource = rs1
Text5.DataField = "姓名"
Set Text6.DataSource = rs1
Text6.DataField = "年龄"
Set Text7.DataSource = rs1
Text7.DataField = "性别"
Set Text8.DataSource = rs1
Text8.DataField = "班级"
Set Text9.DataSource = rs1
Text9.DataField = "邮箱"
Label9.Visible = False
Label10.Visible = False
Label11.Visible = False
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Label7.Visible = False
Text10.Visible = False
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 文本作业 where 学号='" & Form12.Text1.Text & "'", db2, adOpenDynamic, adLockOptimistic, -1
Set DataGrid1.DataSource = rs2
Set db3 = New ADODB.Connection
Set rs3 = New ADODB.Recordset
rs3.CursorLocation = adUseClient
db3.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db3.Open
rs3.Open "select 作业序号,附件号,日期,审批 from 附件作业 where 学号='" & Form12.Text1.Text & "'", db3, adOpenDynamic, adLockOptimistic, -1
Set DataGrid2.DataSource = rs3
Set db4 = New ADODB.Connection
Set rs4 = New ADODB.Recordset
rs4.CursorLocation = adUseClient
db4.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db4.Open
rs4.Open "select * from 意见 where 学号='" & Form12.Text1.Text & "'", db4, adOpenDynamic, adLockOptimistic, -1
Set DataGrid3.DataSource = rs4
Set db5 = New ADODB.Connection
Set rs5 = New ADODB.Recordset
rs5.CursorLocation = adUseClient
db5.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db5.Open
rs5.Open "select * from 提问 where 学号='" & Form12.Text1.Text & "'", db5, adOpenDynamic, adLockOptimistic, -1
Set DataGrid4.DataSource = rs5
End Sub
Private Sub Form_Load()
Text11.Text = Form12.Text1.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -