📄 frmstudent.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmStudent
Caption = "学生信息"
ClientHeight = 5070
ClientLeft = 2055
ClientTop = 1965
ClientWidth = 7470
LinkTopic = "Form1"
Picture = "FrmStudent.frx":0000
ScaleHeight = 5070
ScaleWidth = 7470
Begin VB.TextBox TxtSearchName
Height = 270
Left = 2880
TabIndex = 25
Text = "请输入查询关键字"
Top = 4680
Width = 1815
End
Begin VB.CommandButton CmdQuit
Caption = "退出"
Height = 495
Left = 5760
TabIndex = 24
Top = 4560
Width = 1335
End
Begin VB.CommandButton CmdSearch
Caption = "查找"
Height = 495
Left = 4920
TabIndex = 23
Top = 4560
Width = 735
End
Begin VB.ComboBox ComSeaType
Height = 300
ItemData = "FrmStudent.frx":C0E2
Left = 1200
List = "FrmStudent.frx":C0F8
TabIndex = 21
Text = "请选择查询类型"
Top = 4680
Width = 1695
End
Begin VB.CommandButton CmdDelete
Caption = "删除"
Height = 495
Left = 6000
TabIndex = 20
Top = 3480
Width = 1095
End
Begin VB.CommandButton CmdUpdate
Caption = "更新"
Height = 495
Left = 4920
TabIndex = 19
Top = 3960
Width = 1095
End
Begin VB.CommandButton CmdCancel
Caption = "取消"
Height = 495
Left = 6000
TabIndex = 18
Top = 3960
Width = 1095
End
Begin VB.CommandButton CmdAdd
Caption = "添加"
Height = 495
Left = 4920
TabIndex = 17
Top = 3480
Width = 1095
End
Begin VB.CommandButton CmdNext
Caption = "下一条"
Height = 495
Left = 2640
TabIndex = 16
Top = 3480
Width = 810
End
Begin VB.CommandButton CmdPrevious
Caption = "上一条"
Height = 495
Left = 1440
TabIndex = 15
Top = 3480
Width = 810
End
Begin VB.CommandButton CmdLast
Caption = "末一条"
Height = 495
Left = 3960
TabIndex = 14
Top = 3480
Width = 810
End
Begin VB.CommandButton CmdFirst
Caption = "第一条"
Height = 495
Left = 240
TabIndex = 13
Top = 3480
Width = 810
End
Begin MSAdodcLib.Adodc AdodcStudent
Height = 330
Left = 360
Top = 3120
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "Student"
Caption = "AdodcStudent"
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 FraStudent
BackColor = &H80000013&
Caption = "学生基本信息"
Height = 2895
Left = 240
TabIndex = 0
Top = 120
Width = 6975
Begin VB.TextBox TxtSsex
DataField = "Ssex"
DataSource = "AdodcStudent"
Height = 375
Left = 1680
TabIndex = 12
Top = 1320
Width = 1575
End
Begin VB.TextBox TxtClass
DataField = "Class"
DataSource = "AdodcStudent"
Height = 375
Left = 1680
TabIndex = 11
Top = 2160
Width = 1575
End
Begin VB.TextBox TxtSname
DataField = "Sname"
DataSource = "AdodcStudent"
Height = 375
Left = 4920
TabIndex = 10
Top = 480
Width = 1575
End
Begin VB.TextBox TxtSbirthday
DataField = "Sbirthday"
DataSource = "AdodcStudent"
Height = 375
Left = 4920
TabIndex = 9
Top = 1320
Width = 1575
End
Begin VB.TextBox TxtSdept
DataField = "Sdept"
DataSource = "AdodcStudent"
Height = 375
Left = 4920
TabIndex = 8
Top = 2160
Width = 1575
End
Begin VB.TextBox TxtSno
DataField = "Sno"
DataSource = "AdodcStudent"
Height = 375
Left = 1680
TabIndex = 1
Top = 480
Width = 1575
End
Begin VB.Label LabSbirthday
Caption = "出生日期:"
Height = 375
Left = 3600
TabIndex = 7
Top = 1320
Width = 975
End
Begin VB.Label LabSdept
Caption = "系别:"
Height = 375
Left = 3600
TabIndex = 6
Top = 2160
Width = 975
End
Begin VB.Label LabSsex
Caption = "性别:"
Height = 375
Left = 360
TabIndex = 5
Top = 1320
Width = 975
End
Begin VB.Label LabClass
Caption = "班级:"
Height = 375
Left = 360
TabIndex = 4
Top = 2160
Width = 975
End
Begin VB.Label LabSname
Caption = "姓名:"
Height = 375
Left = 3600
TabIndex = 3
Top = 480
Width = 975
End
Begin VB.Label LabSno
Caption = "学号:"
Height = 375
Left = 360
TabIndex = 2
Top = 480
Width = 975
End
End
Begin VB.Label LabSearch
Caption = "查询条件:"
DataSource = "AdodcStudent"
Height = 255
Left = 240
TabIndex = 22
Top = 4680
Width = 1095
End
End
Attribute VB_Name = "FrmStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public SearchType As String
Public SearchName As String
Private Sub CmdAdd_Click()
AdodcStudent.Recordset.AddNew
TxtSno.SetFocus
CmdAdd.Enabled = False
CmdDelete.Enabled = False
CmdCancel.Enabled = True
CmdUpdate.Enabled = True
Call EnableButton(False)
End Sub
Private Sub CmdCancel_Click()
AdodcStudent.Recordset.CancelUpdate
CmdAdd.Enabled = True
CmdDelete.Enabled = True
CmdCancel.Enabled = False
CmdUpdate.Enabled = False
Call EnableButton(True)
End Sub
Private Sub CmdDelete_Click()
Dim r As Integer
r = MsgBox("您确定要删除当前记录?", vbExclamation + vbYesNo, "信息提示")
If r = vbYes Then
AdodcStudent.Recordset.Delete
AdodcStudent.Recordset.MoveNext
If AdodcStudent.Recordset.EOF Then
AdodcStudent.Recordset.MoveLast
End If
End If
End Sub
Private Sub CmdFirst_Click()
AdodcStudent.Recordset.MoveFirst
End Sub
Private Sub CmdLast_Click()
AdodcStudent.Recordset.MoveLast
End Sub
Private Sub CmdNext_Click()
AdodcStudent.Recordset.MoveNext
If AdodcStudent.Recordset.EOF Then AdodcStudent.Recordset.MoveLast
End Sub
Private Sub CmdPrevious_Click()
AdodcStudent.Recordset.MovePrevious
If AdodcStudent.Recordset.BOF Then AdodcStudent.Recordset.MoveFirst
End Sub
Private Sub CmdQuit_Click()
FrmChoose.Show
Unload Me
End Sub
Private Sub CmdSearch_Click()
SearchName = TxtSearchName.Text
If TxtSearchName.Text = "" Then
MsgBox "您没有输入查询条件", vbExclamation, "出错信息"
Else
Unload Me
FrmSsearch.Show
End If
End Sub
Private Sub CmdUpdate_Click()
If TxtSno.Text = "" Then
MsgBox "对不起,学号不能为空值,请您重新输入", vbExclamation, "出错信息"
TxtSno.SetFocus
Else
If TxtSname.Text = "" Then
MsgBox "对不起,姓名不能为空值,请您重新输入", vbExclamation, "出错信息"
TxtSname.SetFocus
Else
AdodcStudent.Recordset("Sno") = TxtSno.Text
AdodcStudent.Recordset("Sname") = TxtSname.Text
If TxtSbirthday.Text <> "" Then
AdodcStudent.Recordset("Sbirthday") = CDate(TxtSbirthday.Text)
End If
If TxtSsex.Text <> "" Then
AdodcStudent.Recordset("Ssex") = TxtSsex.Text
End If
AdodcStudent.Recordset("Sdept") = TxtSdept.Text
AdodcStudent.Recordset("Class") = TxtClass.Text
AdodcStudent.Recordset.Update
CmdAdd.Enabled = True
CmdDelete.Enabled = True
CmdUpdate.Enabled = False
CmdCancel.Enabled = False
Call EnableButton(True)
End If
End If
End Sub
Private Sub EnableButton(flag As Boolean)
CmdFirst.Enabled = flag
CmdPrevious.Enabled = flag
CmdNext.Enabled = flag
CmdLast.Enabled = flag
End Sub
Private Sub ComSeaType_Click()
Select Case ComSeaType.Text
Case "学号"
SearchType = "Sno"
TxtSearchName.SetFocus
Case "姓名"
SearchType = "Sname"
TxtSearchName.SetFocus
Case "性别"
SearchType = "Ssex"
TxtSearchName.SetFocus
Case "出生日期"
SearchType = "Sbirthday"
TxtSearchName.SetFocus
Case "系别"
SearchType = "Sdept"
TxtSearchName.SetFocus
Case "班级"
SearchType = "Class"
TxtSearchName.SetFocus
Case Else
MsgBox "你没有选中任何条件!", vbOKOnly + vbExclamation, "警告"
End Select
End Sub
Private Sub Form_Load()
CmdCancel.Enabled = False
CmdUpdate.Enabled = False
End Sub
Private Sub TxtSearchName_GotFocus()
TxtSearchName.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -