frmstubase.frm
来自「一款非常适合中小学教学任务不是很繁重的管理程序」· FRM 代码 · 共 553 行 · 第 1/2 页
FRM
553 行
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2520
TabIndex = 8
Top = 1320
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别*"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2520
TabIndex = 7
Top = 1800
Width = 435
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "民族*"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2520
TabIndex = 6
Top = 2280
Width = 435
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生日期"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2340
TabIndex = 5
Top = 2760
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "政治面貌*"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2340
TabIndex = 4
Top = 3240
Width = 795
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "籍贯"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2520
TabIndex = 3
Top = 4680
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学号(主键):"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00004000&
Height = 240
Left = 2505
TabIndex = 2
Top = 840
Width = 1125
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学生基本情况"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4680
TabIndex = 0
Top = 120
Width = 2295
End
End
Attribute VB_Name = "frmStuBase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strSql As String
Dim RS As ADODB.Recordset
Private Sub cmdAdd_Click()
'添加
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
strSql = "insert into 学生基本情况表 values("
strSql = strSql & "'" & Trim(txtNo.Text) & "',"
strSql = strSql & "'" & Trim(txtName.Text) & "',"
strSql = strSql & "'" & Trim(cboSex.Text) & "',"
strSql = strSql & "'" & cboRace.ListIndex + 1 & "',"
strSql = strSql & "'" & Trim(txtDate.Text) & "',"
strSql = strSql & "'" & cboGov.ListIndex + 1 & "',"
strSql = strSql & "'" & Trim(txtPhone.Text) & "',"
strSql = strSql & "'" & Trim(Me.txtEmail.Text) & "',"
strSql = strSql & "'" & Trim(txtPlace.Text) & "',"
strSql = strSql & "'" & txtCommand.Text & "')"
dbOperate strSql
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdDel_Click()
'删除
If Trim(txtNo.Text) <> "" Then
strSql = "delete * from 学生基本情况表 where 学号='" & Trim(txtNo.Text) & "'"
dbOperate strSql
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdFind_Click()
'查找
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
strSql = "select * from 学生基本情况表 where 学号='" & Trim(txtNo.Text) & "'"
Set RS = dbSelect(strSql)
Call clearAll
Me.txtNo.Text = RS.Fields(0)
Me.txtName.Text = RS.Fields(1)
Me.cboSex.Text = RS.Fields(2)
Me.cboRace.ListIndex = RS.Fields(3) - 1
Me.txtDate.Text = RS.Fields(4)
Me.cboGov.ListIndex = RS.Fields(5) - 1
Me.txtPhone.Text = RS.Fields(6)
Me.txtEmail.Text = RS.Fields(7)
Me.txtPlace.Text = RS.Fields(8)
Me.txtCommand.Text = RS.Fields(9)
Set RS = Nothing
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdModiy_Click()
On Error Resume Next
'修改
If Trim(txtNo.Text) <> "" Then
strSql = "update 学生基本情况表 set "
strSql = strSql & "姓名='" & Trim(txtName.Text) & "',"
strSql = strSql & "性别='" & Trim(cboSex.Text) & "',"
strSql = strSql & "民族编号='" & cboRace.ListIndex + 1 & "',"
strSql = strSql & "出生日期='" & Trim(txtDate.Text) & "',"
strSql = strSql & "政治面貌编号='" & cboGov.ListIndex + 1 & "',"
strSql = strSql & "家庭电话='" & Trim(txtPhone.Text) & "',"
strSql = strSql & "电子邮箱='" & Trim(Me.txtEmail.Text) & "',"
strSql = strSql & "籍贯='" & Trim(txtPlace.Text) & "',"
strSql = strSql & "备注='" & txtCommand.Text & "'"
strSql = strSql & " where 学号='" & Trim(txtNo.Text) & "'"
dbOperate strSql
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdPrint_Click()
MsgBox "暂未编码", vbOKCancel + vbExclamation, "抱歉!"
End Sub
Private Sub Form_Load()
'民族和政治面貌入库
On Error Resume Next
strSql = "select 名字 from 民族表"
Set RS = dbSelect(strSql)
While Not RS.EOF
cboRace.AddItem RS.Fields(0)
RS.MoveNext
Wend
strSql = "select 名字 from 政治面貌类型表"
Set RS = dbSelect(strSql)
While Not RS.EOF
cboGov.AddItem RS.Fields(0)
RS.MoveNext
Wend
Me.cboGov.ListIndex = 0
Me.cboRace.ListIndex = 0
Me.cboSex.ListIndex = 0
Set RS = Nothing
Me.WindowsXPC1.InitSubClassing
End Sub
Sub clearAll()
On Error Resume Next
Me.txtNo.Text = ""
Me.txtName.Text = ""
Me.cboSex.Text = ""
Me.cboRace.ListIndex = 0
Me.txtDate.Text = ""
Me.cboGov.ListIndex = 0
Me.txtPhone.Text = ""
Me.txtEmail.Text = ""
Me.txtPlace.Text = ""
Me.txtCommand.Text = ""
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?