www.pudn.com > myActivebart.rar > BASEINFO.frm
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form3
Caption = "学生基本信息录入"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 345
ClientWidth = 8925
Icon = "BASEINFO.frx":0000
LinkTopic = "Form3"
ScaleHeight = 5340
ScaleWidth = 8925
StartUpPosition = 2 '屏幕中心
Begin MSComCtl2.DTPicker DTPicker2
Height = 375
Left = 1260
TabIndex = 33
Top = 1320
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
Format = 171769857
CurrentDate = 36698
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 345
Left = 7050
TabIndex = 32
Top = 750
Width = 1485
_ExtentX = 2619
_ExtentY = 609
_Version = 393216
Format = 171769857
CurrentDate = 36698
End
Begin VB.CommandButton Command6
Caption = "上一条(&P)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1830
TabIndex = 31
Top = 4800
Width = 1185
End
Begin VB.CommandButton Command5
Caption = "下一条(&M)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 3030
TabIndex = 30
Top = 4800
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "退出(&D)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 7500
TabIndex = 29
Top = 4800
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删除(&D)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 6420
TabIndex = 28
Top = 4800
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "修改(&M)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 5340
TabIndex = 27
Top = 4800
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加(&A)"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 4230
TabIndex = 26
Top = 4800
Width = 1095
End
Begin VB.TextBox Text10
Height = 1095
Left = 1260
TabIndex = 25
Top = 3510
Width = 7335
End
Begin VB.TextBox Text9
Height = 345
Left = 1260
TabIndex = 23
Top = 2940
Width = 7305
End
Begin VB.TextBox Text8
Height = 345
Left = 7080
TabIndex = 21
Top = 1860
Width = 1485
End
Begin VB.TextBox Text7
Height = 345
Left = 1230
TabIndex = 19
Top = 2430
Width = 7335
End
Begin VB.TextBox Text6
Height = 345
Left = 4050
TabIndex = 17
Top = 1890
Width = 1485
End
Begin VB.TextBox Text5
Height = 345
Left = 1230
TabIndex = 15
Top = 1890
Width = 1485
End
Begin VB.TextBox Text4
Height = 345
Left = 4080
TabIndex = 13
Top = 1320
Width = 4425
End
Begin VB.ComboBox Combo4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 4080
TabIndex = 11
Top = 780
Width = 1485
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "BASEINFO.frx":08CA
Left = 1260
List = "BASEINFO.frx":08D4
TabIndex = 7
Top = 780
Width = 1485
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 7020
TabIndex = 5
Top = 300
Width = 1485
End
Begin VB.TextBox Text2
Height = 345
Left = 4050
TabIndex = 3
Top = 270
Width = 1485
End
Begin VB.TextBox Text1
Height = 345
Left = 1260
TabIndex = 1
Top = 270
Width = 1485
End
Begin VB.Label Label14
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备注:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 630
TabIndex = 24
Top = 3540
Width = 570
End
Begin VB.Label Label13
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "母亲单位:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 210
TabIndex = 22
Top = 3060
Width = 1020
End
Begin VB.Label Label12
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "母亲姓名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 5970
TabIndex = 20
Top = 1920
Width = 1020
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "父亲单位:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 180
TabIndex = 18
Top = 2550
Width = 1020
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "父亲姓名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 2970
TabIndex = 16
Top = 2010
Width = 1020
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 180
TabIndex = 14
Top = 1980
Width = 1020
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "家庭住址:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 2970
TabIndex = 12
Top = 1380
Width = 1020
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "民族:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3360
TabIndex = 10
Top = 840
Width = 570
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "入学日期:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 210
TabIndex = 9
Top = 1440
Width = 1020
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生日期:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 5910
TabIndex = 8
Top = 810
Width = 1020
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 600
TabIndex = 6
Top = 870
Width = 570
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 6390
TabIndex = 4
Top = 390
Width = 570
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3330
TabIndex = 2
Top = 330
Width = 570
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 600
TabIndex = 0
Top = 330
Width = 570
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private rs As New ADODB.Recordset
Private Sub clearinfo()
'清空界面显示
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo4.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text7.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub
Private Sub updateinfo()
'更新信息
rs.Fields("学号") = Text1.Text
rs.Fields("姓名") = Text2.Text
rs.Fields("班级") = Combo1.Text
rs.Fields("性别") = Combo2.Text
rs.Fields("民族") = Combo4.Text
rs.Fields("出生日期") = DTPicker1.Value
rs.Fields("入学时间") = DTPicker2.Value
rs.Fields("家庭住址") = Text4.Text
rs.Fields("联系电话") = Text5.Text
rs.Fields("父姓名") = Text6.Text
rs.Fields("母姓名") = Text8.Text
rs.Fields("父单位") = Text7.Text
rs.Fields("母单位") = Text9.Text
rs.Fields("备注") = Text10.Text
End Sub
Private Sub Command1_Click()
On Error GoTo error:
If Command1.Caption = "添加(&A)" Then
rs.AddNew
Command1.Caption = "保存(&S)"
clearinfo
Else
updateinfo '更新数据库
rs.Update
Command1.Caption = "添加(&A)"
rs.MoveLast
showinfo
End If
Exit Sub
error:
MsgBox ("录入信息不全!" + Err.Description)
Exit Sub
End Sub
Private Sub Command2_Click()
On Error GoTo error:
'判断当前记录集是否打开
If rs.State = 1 Then
updateinfo
rs.Update
Command2.Caption = "修改(&A)"
MsgBox "修改成功!"
If Not rs.EOF Then rs.MoveNext Else rs.MoveFirst
Else
MsgBox "纪录集未打开从新操作"
Exit Sub
End If
Exit Sub
error:
MsgBox ("录入信息不全!" + Err.Description)
Exit Sub
End Sub
Private Sub Command3_Click()
On Error GoTo error:
If MsgBox("您是否真的要删除", vbYesNo + vbQuestion, "提示") = vbYes Then
If rs.State = 0 Then
MsgBox ("纪录表处于关闭状态")
Exit Sub
End If
rs.Delete
rs.Update
'判断是否到指针尾部,如果没有下移一条,如果到了显示第一条
If rs.RecordCount <> 0 Then
If Not rs.EOF Then
rs.MoveNext
Else
rs.MoveFirst
End If
showinfo
Else
clearinfo
End If
End If
'界面刷新
Exit Sub
error:
MsgBox ("录入信息不全!" + Err.Description)
Exit Sub
End Sub
Private Sub Command4_Click()
Unload Form3
End Sub
Private Sub Command5_Click()
If Not rs.EOF Then
rs.MoveNext
If Not rs.EOF Then showinfo
End If
isEnabled
End Sub
Private Sub Command6_Click()
'如果没到指针首部,上移一条
If Not rs.BOF Then
rs.MovePrevious
If Not rs.BOF Then showinfo
End If
isEnabled
End Sub
Private Sub isEnabled()
'显示控件是否可用
If rs.BOF Then
Command6.Enabled = False
Command5.Enabled = True
End If
If rs.EOF Then
Command6.Enabled = True
Command5.Enabled = False
End If
If Not (rs.BOF Or rs.EOF) Then
Command6.Enabled = True
Command5.Enabled = True
End If
End Sub
Private Sub Form_Initialize()
'list控件显示
Dim strsql As String
strsql = "select * from 基本表"
rs.Open strsql, cnn, adOpenDynamic, adLockOptimistic
If rs.RecordCount <> 0 Then
rs.MoveFirst
End If
showlist
'界面控件显示
showinfo
End Sub
Private Sub showinfo()
If rs.EOF Or rs.BOF Then
clearinfo
Exit Sub
End If
If Not IsNull(rs.Fields("学号")) Then Text1.Text = rs.Fields("学号")
If Not IsNull(rs.Fields("姓名")) Then Text2.Text = rs.Fields("姓名")
If Not IsNull(rs.Fields("班级")) Then Combo1.Text = rs.Fields("班级")
If Not IsNull(rs.Fields("性别")) Then Combo2.Text = rs.Fields("性别")
If Not IsNull(rs.Fields("民族")) Then Combo4.Text = rs.Fields("民族")
If Not IsNull(rs.Fields("出生日期")) Then DTPicker1.Value = rs.Fields("出生日期")
If Not IsNull(rs.Fields("入学时间")) Then DTPicker2.Value = rs.Fields("入学时间")
If Not IsNull(rs.Fields("家庭住址")) Then Text4.Text = rs.Fields("家庭住址")
If Not IsNull(rs.Fields("联系电话")) Then Text5.Text = rs.Fields("联系电话")
If Not IsNull(rs.Fields("父姓名")) Then Text6.Text = rs.Fields("父姓名")
If Not IsNull(rs.Fields("母姓名")) Then Text8.Text = rs.Fields("母姓名")
If Not IsNull(rs.Fields("父单位")) Then Text7.Text = rs.Fields("父单位")
If Not IsNull(rs.Fields("母单位")) Then Text9.Text = rs.Fields("母单位")
If Not IsNull(rs.Fields("备注")) Then Text10.Text = rs.Fields("备注")
End Sub
Private Sub showlist()
Dim rs1 As New ADODB.Recordset
rs1.Open "select * from 民族表", cnn, adOpenDynamic, adLockOptimistic
If rs1.RecordCount <> 0 Then
rs1.MoveFirst
Do While Not rs1.EOF()
Combo4.additem rs1.Fields("民族")
rs1.MoveNext
Loop
End If
rs1.Close
rs1.Open "select * from 班级表", cnn, adOpenDynamic, adLockOptimistic
If rs1.RecordCount <> 0 Then
rs1.MoveFirst
Do While Not rs1.EOF()
Combo1.additem rs1.Fields("班级")
rs1.MoveNext
Loop
End If
End Sub