www.pudn.com > myActivebart.rar > class.frm
VERSION 5.00
Begin VB.Form Form14
Caption = "班级"
ClientHeight = 4305
ClientLeft = 60
ClientTop = 345
ClientWidth = 4425
Icon = "class.frx":0000
LinkTopic = "Form14"
ScaleHeight = 4305
ScaleWidth = 4425
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 990
TabIndex = 6
Top = 180
Width = 3075
End
Begin VB.ListBox List1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 2940
Left = 270
TabIndex = 5
Top = 630
Width = 3825
End
Begin VB.CommandButton Command1
Caption = "添加(&A)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 540
TabIndex = 3
Top = 3660
Width = 915
End
Begin VB.CommandButton Command2
Caption = "修改(&M)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1440
TabIndex = 2
Top = 3660
Width = 915
End
Begin VB.CommandButton Command3
Caption = "删除(&D)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 2340
TabIndex = 1
Top = 3660
Width = 915
End
Begin VB.CommandButton Command4
Caption = "退出(&D)"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 3240
TabIndex = 0
Top = 3660
Width = 915
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 = 360
TabIndex = 4
Top = 240
Width = 570
End
End
Attribute VB_Name = "Form14"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
On Error GoTo error:
If Text1.Text = "" Then
Exit Sub
End If
If rs.State = 1 Then rs.Close
rs.Open "select 班级 from 班级表", cnn, adOpenKeyset, adLockPessimistic
rs.MoveLast
rs.AddNew
rs.Fields("班级") = Text1.Text
rs.Update
additem
Exit Sub
error:
MsgBox (Err.Description)
Exit Sub
End Sub
Private Sub Command2_Click()
On Error GoTo error:
If Text1.Text = "" Then
Exit Sub
End If
If rs.State = 1 Then rs.Close
rs.Open "update 班级表 set 班级= " & "'" & Text1.Text & "' where 班级= " & "'" & List1.List(List1.ListIndex) & "'", cnn, adOpenKeyset, adLockPessimistic
additem
Exit Sub
error:
MsgBox (Err.Description)
Exit Sub
End Sub
Private Sub Command3_Click()
If MsgBox("您是否真的要删除", vbYesNo + vbQuestion, "提示") = vbYes Then
If rs.State = 1 Then rs.Close
rs.Open "delete from 班级表 where 班级 = " & "'" & List1.List(List1.ListIndex) & "'", cnn, adOpenKeyset, adLockPessimistic
additem
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub additem()
If rs.State = 1 Then rs.Close
rs.Open "select 班级 from 班级表", cnn, adOpenKeyset, adLockPessimistic
List1.Clear
If rs.RecordCount <> 0 Then
Do While Not rs.EOF
List1.additem rs.Fields("班级")
rs.MoveNext
Loop
Text1.Text = ""
End If
End Sub
Private Sub Form_Load()
additem
End Sub