【VB开源代码栏目提醒】:网学会员VB开源代码为您提供type_update.frm参考,解决您在type_update.frm学习中工作中的难题,参考学习。
VERSION 5.00
Begin VB.Form type_update
Caption = "考试类别维护"
ClientHeight = 5055
ClientLeft = 60
ClientTop = 345
ClientWidth = 7020
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5055
ScaleWidth = 7020
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command3
Caption = "关闭"
Height = 495
Left = 4800
TabIndex = 7
Top = 4200
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 495
Left = 3000
TabIndex = 6
Top = 4200
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 495
Left = 1200
TabIndex = 5
Top = 4200
Width = 1095
End
Begin VB.TextBox Text4
Height = 375
Left = 1440
TabIndex = 4
Top = 3480
Width = 4695
End
Begin VB.TextBox Text3
Height = 375
Left = 1440
TabIndex = 3
Top = 2880
Width = 4695
End
Begin VB.TextBox Text2
Height = 375
Left = 4920
TabIndex = 2
Top = 2280
Width = 1575
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 1
Top = 2280
Width = 1575
End
Begin
VB.ListBox List1
DataSource = "Adodc1"
Height = 1740
ItemData = "type_update.frx":0000
Left = 240
List = "type_update.frx":0002
TabIndex = 0
Top = 240
Width = 6375
End
Begin VB.Label Label4
Caption = "说明:"
Height = 375
Left = 240
TabIndex = 11
Top = 3480
Width = 975
End
Begin VB.Label Label3
Caption = "类别名称:"
Height = 375
Left = 240
TabIndex = 10
Top = 2880
Width = 1095
End
Begin VB.Label Label2
Caption = "考试时间:"
Height = 375
Left = 3600
TabIndex = 9
Top = 2280
Width = 1095
End
Begin VB.Label Label1
Caption = "类别号:"
Height = 375
Left = 240
TabIndex = 8
Top = 2280
Width = 975
End
End
Attribute VB_Name = "type_update"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim str As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
str = Trim(List1.Text)
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from type where tname='" & str & "'"
rs.Open sql, cn, 3, 2
rs("tno") = Trim(Text1.Text)
rs("tname") = Trim(Text3.Text)
rs("ttime") = Trim(Text2.Text)
rs("tmemo") = Trim(Text4.Text)
rs.Update
MsgBox "修改成功"
Adodc1.Refresh
List1.Refresh
End Sub
Private Sub Command2_Click()
Dim str As String
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
str = Trim(List1.Text)
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\file.mdb;Persist Security Info=False"
sql = "select * from type where tname='" & str & "'"
rs.Open sql, cn, 3, 2
response = MsgBox("确定要删除此类别吗?", vbOKCancel + 32, "提示")
If response = vbOK Then
rs.Delete
MsgBox "删除成功"
Adodc1.Refresh
List1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
End Sub
Private Sub Form_Load()
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 type"
rs.Open sql, cn, 1, 1
Do While rs.EOF <> True
List1.AddItem rs("tname")
rs.MoveNext
Loop
End Sub
Private Sub List1_Click()
Dim str As String
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"
str = Trim(List1.Text)
sql = "select * from type where tname='" & str & "'"
rs.Open sql, cn, 1, 1
Text1.Text = rs("tno")
Text2.Text = rs("ttime")
Text3.Text = rs("tname")
Text4.Text = rs("tmemo")
End Sub