📄 addstu.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form AddStu
Caption = "学生信息修改"
ClientHeight = 7155
ClientLeft = 60
ClientTop = 345
ClientWidth = 9675
LinkTopic = "Form3"
ScaleHeight = 7155
ScaleWidth = 9675
StartUpPosition = 3 '窗口缺省
Begin MSDataGridLib.DataGrid StuDG
Bindings = "AddStu.frx":0000
Height = 2655
Left = 360
TabIndex = 24
Top = 3840
Width = 8535
_ExtentX = 15055
_ExtentY = 4683
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "学生信息"
Height = 2895
Left = 720
TabIndex = 1
Top = 840
Width = 8535
Begin MSDataGridLib.DataGrid DataGrid1
Height = 30
Left = 0
TabIndex = 23
Top = 2880
Width = 7095
_ExtentX = 12515
_ExtentY = 53
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.TextBox StuBZ
Height = 1815
Left = 6600
TabIndex = 22
Top = 480
Width = 1695
End
Begin VB.CommandButton StuCal
Caption = "取消"
Height = 495
Left = 7200
TabIndex = 21
Top = 2400
Width = 1215
End
Begin VB.CommandButton StuDel
Caption = "删除"
Height = 495
Left = 5760
TabIndex = 20
Top = 2400
Width = 1095
End
Begin VB.CommandButton StuUpd
Caption = "更新"
Height = 495
Left = 4200
TabIndex = 19
Top = 2400
Width = 1215
End
Begin MSAdodcLib.Adodc StuADO
Height = 495
Left = 120
Top = 2400
Width = 3735
_ExtentX = 6588
_ExtentY = 873
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 = ""
Password = ""
RecordSource = "Select * from XS,CXB where XS.XB=CXB.XB"
Caption = "添加修改删除学生记录"
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
Begin VB.Frame Frame2
Height = 615
Left = 960
TabIndex = 14
Top = 1560
Width = 1575
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 300
Left = 840
TabIndex = 16
Top = 240
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 495
Left = 120
TabIndex = 15
Top = 120
Width = 255
End
Begin VB.Label Label10
Caption = "女"
Height = 255
Left = 1080
TabIndex = 18
Top = 240
Width = 255
End
Begin VB.Label Label9
Caption = "男"
Height = 255
Left = 360
TabIndex = 17
Top = 240
Width = 375
End
End
Begin VB.TextBox StuZXF
Height = 495
Left = 3840
TabIndex = 7
Top = 1680
Width = 1935
End
Begin VB.TextBox StuZY
Height = 495
Left = 3840
TabIndex = 6
Top = 1080
Width = 1935
End
Begin VB.TextBox StuCSSJ
Height = 495
Left = 3840
TabIndex = 5
Top = 480
Width = 1935
End
Begin VB.TextBox StuXM
Height = 495
Left = 960
TabIndex = 4
Top = 1080
Width = 1575
End
Begin VB.TextBox StuXH
Height = 495
Left = 960
TabIndex = 3
Top = 480
Width = 1575
End
Begin VB.Label Label8
Caption = "备注"
Height = 495
Left = 6000
TabIndex = 13
Top = 600
Width = 615
End
Begin VB.Label Label7
Caption = "总学分"
Height = 375
Left = 3000
TabIndex = 12
Top = 1800
Width = 735
End
Begin VB.Label Label6
Caption = "专业"
Height = 495
Left = 3000
TabIndex = 11
Top = 1200
Width = 855
End
Begin VB.Label Label5
Caption = "出生日期"
Height = 495
Left = 2880
TabIndex = 10
Top = 600
Width = 855
End
Begin VB.Label Label4
Caption = "性别"
Height = 375
Left = 360
TabIndex = 9
Top = 1800
Width = 855
End
Begin VB.Label Label3
Caption = "姓名"
Height = 255
Left = 360
TabIndex = 8
Top = 1200
Width = 615
End
Begin VB.Label Label2
Caption = "学号"
Height = 375
Left = 360
TabIndex = 2
Top = 600
Width = 975
End
End
Begin VB.Label Label1
Caption = "添加修改删除学生记录"
BeginProperty Font
Name = "华文行楷"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
TabIndex = 0
Top = 360
Width = 4695
End
End
Attribute VB_Name = "AddStu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private SqlCon As New ADODB.Connection
Private SqlRes As New ADODB.Recordset
Private SqlCmd As New ADODB.Command
Private Sub Form_Load()
SqlCon.Provider = "SQLOLEDB"
SqlCon.Open "Server=DCR;DataBase=XSCJ;UID=sa;PWD=;"
End Sub
Private Sub Form_Unload(Cancel As Integer)
SqlCon.Close
End Sub
Private Sub StuADO_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Not pRecordset.EOF And Not pRecordset.BOF Then
StuXH.Text = pRecordset("XH")
StuXM.Text = pRecordset("XM")
StuCSSJ.Text = pRecordset("CSSJ")
StuZY.Text = pRecordset("ZY")
StuZXF.Text = pRecordset("ZXF")
StuBZ.Text = CStr(pRecordset("BZ") & "")
If pRecordset("XB") = 0 Then
StuXBF.Value = True
Else
StuXBM.Value = True
End If
End If
End Sub
Private Sub StuDel_Click()
Ret = MsgBox("是否要删除" + StuADO.Recordset("XH") + "号学生的记录!", vbYesNo, "提示")
If Ret = vbYes Then
SqlCmd.ActiveConnection = SqlCon
SqlCmd.CommandText = "delete from XS where XH='" + StuADO.Recordset("XH") + "'"
SqlCmd.Execute
StuADO.RecordSource = "select * from XS,CXB where XS.XB=CXB.XB"
StuADO.Refresh
End If
End Sub
Private Sub StuUpd_Click()
Dim SqlStr As String
SqlStr = "select * from XS where XH='" + Trim(StuXH.Text) + "'"
SqlRes.Open SqlStr, SqlCon, adOpenDynamic, adLockPessimistic
If Not SqlRes.EOF Then
SqlRes("XM") = StuXM.Text
If StuXBM.Value = True Then
SqlRes("XB") = 1
Else
SqlRes("XB") = 0
End If
SqlRes("ZY") = StuZY.Text
SqlRes("CSSJ") = CDate(StuCSSJ.Text)
SqlRes("ZXF") = CInt(StuZXF.Text)
SqlRes("BZ") = StuBZ.Text
SqlRes.Update
Else
SqlRes.AddNew
SqlRes("XH") = StuXH.Text
SqlRes("XM") = StuXM.Text
If StuXBM.Value = True Then
SqlRes("XB") = 1
Else
SqlRes("XB") = 0
End If
SqlRes("ZY") = StuZY.Text
SqlRes("CSSJ") = CDate(StuCSSJ.Text)
If Trim(StuZXF.Text) <> "" Then
SqlRes("ZXF") = CInt(StuZXF.Text)
End If
SqlRes("BZ") = StuBZ.Text
SqlRes.Update
End If
SqlRes.Close
StuADO.RecordSource = "select * from XS,CXB where XS.XB=CXB.XB"
StuADO.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -