?? frmxs2.frm
字號:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 21
Top = 1440
Width = 1095
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "班 級"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 20
Top = 1920
Width = 1095
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "數(shù)學成績"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 19
Top = 960
Width = 1095
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "語文成績"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 18
Top = 480
Width = 1095
End
Begin VB.Label Label8
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "英語成績"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 17
Top = 1440
Width = 1095
End
Begin VB.Label Label9
BackColor = &H00E2F0C1&
BackStyle = 0 'Transparent
Caption = "共"
Height = 255
Left = 4080
TabIndex = 16
Top = 2040
Width = 255
End
Begin VB.Label Label10
BackStyle = 0 'Transparent
Caption = "條記錄"
Height = 255
Left = 5640
TabIndex = 15
Top = 2040
Width = 735
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2055
Left = 0
TabIndex = 11
Top = 3360
Width = 9015
_ExtentX = 15901
_ExtentY = 3625
_Version = 393216
Rows = 6
Cols = 8
FixedCols = 0
BackColor = 15518939
ForeColor = 33023
BackColorFixed = 16761024
ForeColorFixed = 16576
BackColorSel = -2147483646
ForeColorSel = 12648447
BackColorBkg = 14743774
GridColor = 16761024
GridColorFixed = 16761087
GridLinesFixed = 3
SelectionMode = 1
AllowUserResizing= 1
Appearance = 0
FormatString = "序號|學號|姓名|性別|班級|語文成績|數(shù)學成績|英語成績"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "楷體_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "學生管理系統(tǒng)"
BeginProperty Font
Name = "隸書"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF8080&
Height = 495
Left = 2400
TabIndex = 12
Top = 120
Width = 4215
End
End
Attribute VB_Name = "frmXs2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim jfm As New ADODB.Recordset
Dim Cj As New ADODB.Recordset
Dim xsjl As New ADODB.Connection
Dim SQL As String
Private Sub CmdClear_Click()
Call Clear
End Sub
Private Sub CmdDelete_Click()
If TxtXH.Text = "" Then
MsgBox "學號不能為空!", vbOKOnly, "information"
TxtXH.SetFocus
Exit Sub
End If
SQL = "delete from 學生檔案 where 學號='" & TxtXH.Text & "'"
cnn.Execute (SQL)
Call Data_Display
Call Clear
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub CmdSave_Click()
'On Error Resume Next
Dim Msg As String
Dim Sid As Integer
Dim jfm As New ADODB.Recordset
Dim Cj As New ADODB.Recordset
Dim SQL As String
'Dim xsjl As String
'檢查是否存在該學生生數(shù)據(jù)
If TxtXH.Text = "" Then
MsgBox "學號不能為空!", vbOKOnly, "information"
TxtXH.SetFocus
Exit Sub
End If
If IsNumeric(TxtYw.Text) = False Then
MsgBox "語文成績?yōu)閿?shù)字,請重新輸入!", vbOKOnly, "information"
TxtYw.SetFocus
Exit Sub
End If
If IsNumeric(TxtSx.Text) = False Then
MsgBox "數(shù)學成績?yōu)閿?shù)字,請重新輸入!", vbOKOnly, "information"
TxtSx.SetFocus
Exit Sub
End If
If IsNumeric(TxtYy.Text) = False Then
MsgBox "英語成績?yōu)閿?shù)字,請重新輸入!", vbOKOnly, "information"
TxtYy.SetFocus
Exit Sub
End If
SQL = "select 學號 from 學生檔案 where 學號='" & TxtXH.Text & "'"
Set xsjl = cnn.Execute(SQL)
If xsjl.BOF And xsjl.EOF Then
SQL = "insert into 學生檔案 (學號,姓名,性別,班級) "
SQL = SQL & "values ('" & TxtXH.Text & "','" & TxtXM.Text & "','" & TxtXB.Text & "','" & TxtBJ.Text & "')"
cnn.Execute (SQL)
SQL = "select max(s_id) from 學生檔案"
Set jfm = cnn.Execute(SQL)
SQL = "insert into 學生成績 (s_id,學習科目,成績) values (" & jfm(0) & ",'語文','" & TxtYw.Text & "')"
cnn.Execute (SQL)
SQL = "insert into 學生成績 (s_id,學習科目,成績) values (" & jfm(0) & ",'數(shù)學','" & TxtSx.Text & "')"
cnn.Execute (SQL)
SQL = "insert into 學生成績 (s_id,學習科目,成績) values (" & jfm(0) & ",'英語','" & TxtYy.Text & "')"
cnn.Execute (SQL)
MsgBox "存盤成功!", vbOKOnly, "information"
Else
SQL = "update 學生檔案 set 姓名='" & TxtXM.Text & "',性別='" & TxtXB.Text & "',班級='" & TxtBJ.Text & "' where 學號='" & TxtXH.Text & "'"
cnn.Execute (SQL)
SQL = "select s_id from 學生檔案 where 學號='" & TxtXH.Text & "'"
Set jfm = cnn.Execute(SQL)
SQL = "update 學生成績 set 成績='" & TxtYw.Text & "' where s_id=" & jfm(0) & " and 學習科目='語文'"
cnn.Execute (SQL)
SQL = "update 學生成績 set 成績='" & TxtSx.Text & "' where s_id=" & jfm(0) & " and 學習科目='數(shù)學'"
cnn.Execute (SQL)
SQL = "update 學生成績 set 成績='" & TxtYy.Text & "' where s_id=" & jfm(0) & " and 學習科目='英語'"
cnn.Execute (SQL)
MsgBox "修改成功!", vbOKOnly, "information"
End If
Call Data_Display
End Sub
Private Sub Command1_Click()
TxtCx1.Text = Trim(TxtCx1.Text)
TxtCx2.Text = Trim(TxtCx2.Text)
If TxtCx1.Text <> "" And TxtCx2.Text <> "" Then
SQL = "select * from 學生檔案 where " & Combo1.Text & " like '" & TxtCx1.Text & "' and " & Combo2.Text & " like '" & TxtCx2.Text & "'"
GoTo cont1
End If
If TxtCx1.Text <> "" Then
SQL = "select * from 學生檔案 where " & Combo1.Text & " like '" & TxtCx1.Text & "'"
GoTo cont1
End If
If TxtCx2.Text <> "" Then
SQL = "select * from 學生檔案 where " & Combo2.Text & " like '" & TxtCx2.Text & "'"
GoTo cont1
End If
SQL = "select * from 學生檔案"
cont1:
Set jfm = cnn.Execute(SQL)
Call Data_Display
End Sub
Private Sub Form_Load()
TextJls.Text = ""
Call Clear
Call MSFG_Clear
SQL = "select * from 學生檔案"
Set jfm = cnn.Execute(SQL)
Call Data_Display
End Sub
Private Sub MSFG_Clear()
MSFlexGrid1.ColWidth(0) = 800
MSFlexGrid1.ColAlignment(0) = flexAlignCenterCenter
MSFlexGrid1.ColWidth(1) = 800
MSFlexGrid1.ColWidth(2) = 1400
MSFlexGrid1.ColWidth(3) = 800
MSFlexGrid1.ColWidth(4) = 1300
MSFlexGrid1.ColWidth(5) = 1200
MSFlexGrid1.ColWidth(6) = 1200
MSFlexGrid1.ColWidth(7) = 1200
MSFlexGrid1.Rows = 1
End Sub
Private Sub Clear()
TxtXH.Text = ""
TxtXM.Text = ""
TxtXB.Text = ""
TxtBJ.Text = ""
TxtYw.Text = ""
TxtSx.Text = ""
TxtYy.Text = ""
TxtCx1.Text = ""
Combo1.Text = "學號"
TxtCx2.Text = ""
Combo2.Text = "姓名"
End Sub
Private Sub Data_Display()
Dim i As Integer
MSFlexGrid1.Rows = 1 '清空表
If (Not jfm.BOF) And (Not jfm.EOF) Then
i = 0
jfm.MoveFirst
Do While Not jfm.EOF
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
i = i + 1
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 0) = i
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 1) = Trim(jfm("學號"))
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 2) = Trim(jfm("姓名"))
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 3) = Trim(jfm("性別"))
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 4) = Trim(jfm("班級"))
SQL = "select * from 學生成績 where s_id='" & Trim(jfm("s_id")) & "'"
Set Cj = cnn.Execute(SQL)
If (Not Cj.BOF) And (Not Cj.EOF) Then
Cj.MoveFirst
Do While Not Cj.EOF
If Trim(Cj("學習科目")) = "語文" Then
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 5) = Trim(Cj("成績"))
End If
If Trim(Cj("學習科目")) = "數(shù)學" Then
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 6) = Trim(Cj("成績"))
End If
If Trim(Cj("學習科目")) = "英語" Then
MSFlexGrid1.TextMatrix(MSFlexGrid1.Rows - 1, 7) = Trim(Cj("成績"))
End If
Cj.MoveNext
Loop
End If
jfm.MoveNext
Loop
TextJls.Text = i
End If
End Sub
Private Sub MSFlexGrid1_Click()
TxtXH.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1)
TxtXM.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
TxtXB.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
TxtBJ.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
TxtYw.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 5)
TxtSx.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 6)
TxtYy.Text = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 7)
End Sub
Private Sub MSFlexGrid1_RowColChange()
Call MSFlexGrid1_Click
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -