【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-stu_delete.frm,希望本篇文章对您学习有所帮助。
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form stu_delete
Caption = "考生记录删除"
ClientHeight = 6270
ClientLeft = 60
ClientTop = 345
ClientWidth = 8310
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 6270
ScaleWidth = 8310
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command3
Caption = "关闭"
Height = 495
Left = 4800
TabIndex = 10
Top = 5280
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 1920
TabIndex = 9
Top = 5280
Width = 1095
End
Begin VB.TextBox Text6
Height = 375
Left = 1680
TabIndex = 8
Top = 4440
Width = 5415
End
Begin VB.OptionButton Option4
Caption = "女"
Height = 375
Left = 2520
TabIndex = 7
Top = 2280
Width = 615
End
Begin VB.OptionButton Option3
Caption = "男"
Height = 375
Left = 1680
TabIndex = 6
Top = 2280
Width = 615
End
Begin VB.TextBox Text5
Height = 375
Left = 1680
TabIndex = 5
Top = 3720
Width = 3615
End
Begin VB.TextBox Text4
Height = 375
Left = 5280
TabIndex = 4
Top = 3000
Width = 2775
End
Begin VB.TextBox Text3
Height = 375
Left = 1680
TabIndex = 3
Top = 1560
Width = 1815
End
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 2
Top = 3000
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 1
Top = 480
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "检索"
Height = 495
Left = 4320
TabIndex = 0
Top = 360
Width = 1095
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 7440
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin
VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 1815
Left = 6000
Top = 240
Width = 1455
End
Begin VB.Label Label8
Caption = "照 片"
Height = 375
Left = 6240
TabIndex = 18
Top = 2280
Width = 1215
End
Begin VB.Label Label7
Caption = "地址:"
Height = 375
Left = 360
TabIndex = 17
Top = 4440
Width = 1095
End
Begin VB.Label Label6
Caption = "身份证号:"
Height = 375
Left = 3840
TabIndex = 16
Top = 3000
Width = 1095
End
Begin VB.Label Label5
Caption = "所属单位:"
Height = 375
Left = 360
TabIndex = 15
Top = 3720
Width = 1095
End
Begin VB.Label Label4
Caption = "年龄:"
Height = 375
Left = 360
TabIndex = 14
Top = 3000
Width = 855
End
Begin VB.Label Label3
Caption = ":"
Height = 375
Left = 360
TabIndex = 13
Top = 1560
Width = 1095
End
Begin VB.Label Label2
Caption = "性别:"
Height = 375
Left = 360
TabIndex = 12
Top = 2280
Width = 1095
End
Begin VB.Label Label1
Caption = "准考证号:"
Height = 375
Left = 360
TabIndex = 11
Top = 480
Width = 1095
End
End
Attribute VB_Name = "stu_delete"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As Variant
Dim str As String
Private Sub Command1_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_stu where zkzh='" & Text1.Text & "'"
rs.Open
sql, cn, 1, 1
If rs.EOF = True Then
MsgBox "没有找到该考生"
Else
Text1.Enabled = False
Text2.Text = rs("age")
Text3.Text = rs("name")
Text4.Text = rs("sfzh")
Text5.Text = rs("dept")
Text6.Text = rs("address")
If rs("gentle") = "男" Then
Option3.Value = True
Else
Option4.Value = True
End If
str = Trim(rs("photo"))
Image1.Stretch = True
Image1.Picture = LoadPicture(str)
End If
End Sub
Private Sub Command2_Click()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from info_stu where zkzh='" & Text1.Text & "'"
rs.Open sql, cn, 3, 2
response = MsgBox("确定要删除此考生记录吗?", vbOKCancel + 32, "提示")
If response = vbOK Then
rs.Delete
MsgBox "删除成功"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Image1.Picture = LoadPicture()
End If
End Sub
Private Sub Image1_Click()
Me.CommonDialog1.ShowOpen
str = Me.CommonDialog1.FileName
right1 = Right(str, 3)
If right1 <> "jpg" Then
MsgBox "请选择正确的图片格式"
Else
Image1.Stretch = True
Image1.Picture = LoadPicture(str)
End If
End Sub