📄 infobrow.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form infobrow
BackColor = &H00E7DFE7&
Caption = "学生信息删除"
ClientHeight = 5880
ClientLeft = 60
ClientTop = 450
ClientWidth = 9615
Icon = "infobrow.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5880
ScaleWidth = 9615
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo3
Height = 300
Left = 1155
TabIndex = 6
Text = "Combo3"
Top = 3720
Width = 1575
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1155
TabIndex = 5
Text = "Combo2"
Top = 3240
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
IMEMode = 3 'DISABLE
Left = 1155
TabIndex = 4
Text = "Combo1"
Top = 2040
Width = 1575
End
Begin VB.TextBox Text2
Height = 390
Left = 1155
TabIndex = 3
Top = 1440
Width = 1575
End
Begin VB.TextBox Text3
Height = 375
Left = 1155
TabIndex = 2
Top = 4320
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 1155
TabIndex = 1
Top = 840
Width = 1575
End
Begin SmartXPButton.XpButton XpButton6
Height = 495
Left = 240
TabIndex = 0
Top = 5280
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "删除"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":0A02
End
Begin SmartXPButton.XpButton XpButton5
Height = 495
Left = 8160
TabIndex = 7
Top = 5280
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "关闭"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":1414
End
Begin SmartXPButton.XpButton XpButton4
Height = 495
Left = 6480
TabIndex = 8
Top = 5280
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "最后一条"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":1E26
End
Begin SmartXPButton.XpButton XpButton3
Height = 495
Left = 4920
TabIndex = 9
Top = 5280
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "下一条"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":2838
End
Begin SmartXPButton.XpButton XpButton2
Height = 495
Left = 3360
TabIndex = 10
Top = 5280
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "上一条"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":324A
End
Begin SmartXPButton.XpButton XpButton1
Height = 495
Left = 1800
TabIndex = 11
Top = 5280
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "第一条"
PictureSmoothBackColor= 15460844
ButtonPicture = "infobrow.frx":3C5C
End
Begin MSMask.MaskEdBox txtBirth
Height = 390
Left = 1155
TabIndex = 12
Top = 2520
Width = 1575
_ExtentX = 2778
_ExtentY = 688
_Version = 393216
MaxLength = 10
Mask = "####-##-##"
PromptChar = "_"
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3330
Left = 3360
TabIndex = 13
Top = 840
Width = 5895
_ExtentX = 10398
_ExtentY = 5874
_Version = 393216
AllowUpdate = 0 'False
BackColor = 16777215
ForeColor = -2147483642
HeadLines = 1
RowHeight = 18
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.Label label1
BackStyle = 0 'Transparent
Caption = "学生信息删除"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000002&
Height = 495
Left = 3600
TabIndex = 22
Top = 0
Width = 2895
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "籍贯:"
Height = 255
Left = 555
TabIndex = 21
Top = 4440
Width = 495
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "系编号:"
Height = 255
Left = 435
TabIndex = 20
Top = 3840
Width = 1215
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "生日:"
Height = 495
Left = 555
TabIndex = 19
Top = 2640
Width = 1215
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "姓名:"
Height = 375
Left = 555
TabIndex = 18
Top = 1560
Width = 1335
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "班级编号:"
Height = 375
Left = 240
TabIndex = 17
Top = 3360
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "性别:"
Height = 255
Left = 555
TabIndex = 16
Top = 2160
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "学号:"
Height = 495
Left = 555
TabIndex = 15
Top = 960
Width = 615
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "Label9"
Height = 375
Left = 3360
TabIndex = 14
Top = 4320
Width = 5175
End
End
Attribute VB_Name = "infobrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents MyRs As ADODB.Recordset
Attribute MyRs.VB_VarHelpID = -1
Dim myrs1 As ADODB.Recordset
Dim myrs2 As ADODB.Recordset
Dim str As String
Dim myconn As ADODB.Connection
Private Sub Form_Load()
Set myconn = New ADODB.Connection
myconn.ConnectionString = "driver={SQL Server};" & _
"server=(local);uid=sa;pwd=;database=student_info"
myconn.Open
'***** 使用Recordset对象的Open方法创建记录集 *****
'myrs.Open "student", myconn, adOpenStatic, adLockOptimistic, adCmdTable
Set MyRs = New ADODB.Recordset
MyRs.ActiveConnection = myconn
MyRs.Source = "student"
MyRs.CursorLocation = adUseClient
MyRs.CursorType = adOpenStatic
MyRs.Open , , , adLockOptimistic
Set DataGrid1.DataSource = MyRs
DataGrid1.Columns(0).Caption = "学号"
DataGrid1.Columns(1).Caption = "姓名"
DataGrid1.Columns(2).Caption = "性别"
DataGrid1.Columns(3).Caption = "班级编号"
DataGrid1.Columns(4).Caption = "院系编号"
DataGrid1.Columns(5).Caption = "生日"
DataGrid1.Columns(6).Caption = "籍贯"
DataGrid1.Columns(3).Width = 1100
DataGrid1.Columns(5).Width = 1200
DataGrid1.Columns(6).Width = 1000
str = "select ID from DEPARTMENT"
Set myrs1 = myconn.Execute(str)
While Not myrs1.EOF
Combo3.AddItem myrs1!ID
myrs1.MoveNext
Wend
str = "select ID from CLASS"
Set myrs2 = myconn.Execute(str)
While Not myrs2.EOF
Combo2.AddItem myrs2!ID
myrs2.MoveNext
Wend
Combo1.AddItem "男"
Combo1.AddItem "女"
End Sub
Private Sub XpButton1_Click()
MyRs.MoveFirst
End Sub
Private Sub XpButton2_Click()
MyRs.MovePrevious
If MyRs.BOF = True Then
MyRs.MoveFirst
End If
End Sub
Private Sub XpButton3_Click()
MyRs.MoveNext
If MyRs.EOF = True Then
MyRs.MoveLast
End If
End Sub
Private Sub XpButton4_Click()
MyRs.MoveLast
End Sub
Private Sub XpButton5_Click()
MyRs.Close
myconn.Close
Unload Me
End Sub
Private Sub MyRs_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Label9.Caption = "当前记录/记录总数:" & MyRs.AbsolutePosition & "/" & MyRs.RecordCount
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Combo1.Locked = False
Combo2.Locked = False
Combo3.Locked = False
txtBirth.Enabled = True
If MyRs.EOF = True Then
MyRs.MoveLast
Else
If MyRs.BOF = True Then
MyRs.MoveFirst
Else
Text1.Text = MyRs.Fields(0)
Text2.Text = MyRs.Fields(1)
Text3.Text = MyRs.Fields(6)
Combo1.Text = MyRs.Fields(2)
Combo2.Text = MyRs.Fields(3)
Combo3.Text = MyRs.Fields(4)
txtBirth.Mask = ""
txtBirth.Text = Format$(MyRs.Fields(5))
End If
End If
Text1.Locked = True
Text2.Locked = True
Text3.Locked = True
Combo1.Locked = True
Combo2.Locked = True
Combo3.Locked = True
txtBirth.Enabled = False
End Sub
Private Sub XpButton6_Click()
With MyRs
.Delete adAffectCurrent
.Update
End With
MyRs.MovePrevious
If MyRs.BOF = True Then
MyRs.MoveFirst
End If
MsgBox "学生信息删除成功!", vbOKOnly + vbExclamation, "错误提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -