www.pudn.com > myActivebart.rar > nationatily.frm


VERSION 5.00 
Begin VB.Form Form12  
   Caption         =   "民族" 
   ClientHeight    =   4230 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   4335 
   Icon            =   "nationatily.frx":0000 
   LinkTopic       =   "Form12" 
   ScaleHeight     =   4230 
   ScaleWidth      =   4335 
   StartUpPosition =   2  '屏幕中心 
   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        =   6 
      Top             =   3750 
      Width           =   915 
   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            =   360 
      TabIndex        =   5 
      Top             =   660 
      Width           =   3825 
   End 
   Begin VB.TextBox Text1  
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H00C00000& 
      Height          =   345 
      Left            =   1020 
      TabIndex        =   3 
      Top             =   150 
      Width           =   3075 
   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            =   510 
      TabIndex        =   2 
      Top             =   3750 
      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            =   2370 
      TabIndex        =   1 
      Top             =   3750 
      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            =   3270 
      TabIndex        =   0 
      Top             =   3750 
      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             =   210 
      Width           =   570 
   End 
End 
Attribute VB_Name = "Form12" 
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