www.pudn.com > textmanager.rar > FrmStudentb.frm, change:2005-04-12,size:28050b


VERSION 5.00 
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX" 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" 
Begin VB.Form FrmStudent  
   Caption         =   "考生信息录入" 
   ClientHeight    =   8595 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   11880 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   ScaleHeight     =   8595 
   ScaleWidth      =   11880 
   Begin VB.Frame Frame3  
      Height          =   7815 
      Left            =   60 
      TabIndex        =   0 
      Top             =   120 
      Width           =   11775 
      Begin MSDataGridLib.DataGrid DGKaoSheng  
         Height          =   5550 
         Left            =   2760 
         TabIndex        =   17 
         Top             =   2145 
         Width           =   8880 
         _ExtentX        =   15663 
         _ExtentY        =   9790 
         _Version        =   393216 
         AllowUpdate     =   0   'False 
         BackColor       =   15267064 
         HeadLines       =   1 
         RowHeight       =   18 
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         ColumnCount     =   2 
         BeginProperty Column00  
            DataField       =   "" 
            Caption         =   "" 
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}  
               Type            =   0 
               Format          =   "" 
               HaveTrueFalseNull=   0 
               FirstDayOfWeek  =   0 
               FirstWeekOfYear =   0 
               LCID            =   2052 
               SubFormatType   =   0 
            EndProperty 
         EndProperty 
         BeginProperty Column01  
            DataField       =   "" 
            Caption         =   "" 
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}  
               Type            =   0 
               Format          =   "" 
               HaveTrueFalseNull=   0 
               FirstDayOfWeek  =   0 
               FirstWeekOfYear =   0 
               LCID            =   2052 
               SubFormatType   =   0 
            EndProperty 
         EndProperty 
         SplitCount      =   1 
         BeginProperty Split0  
            MarqueeStyle    =   3 
            BeginProperty Column00  
            EndProperty 
            BeginProperty Column01  
            EndProperty 
         EndProperty 
      End 
      Begin VB.Frame Frame1  
         Caption         =   "学生基本信息" 
         Height          =   1755 
         Left            =   2745 
         TabIndex        =   1 
         Top             =   330 
         Width           =   8925 
         Begin VB.Frame Frame8  
            Caption         =   "编辑" 
            Height          =   1305 
            Left            =   7230 
            TabIndex        =   22 
            Top             =   255 
            Width           =   1650 
            Begin VB.CommandButton CmdExit  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   885 
               Picture         =   "FrmStudentb.frx":0000 
               Style           =   1  'Graphical 
               TabIndex        =   27 
               ToolTipText     =   "关闭窗口" 
               Top             =   840 
               Width           =   645 
            End 
            Begin VB.CheckBox CheQK  
               Appearance      =   0  'Flat 
               Caption         =   "添加时清空" 
               ForeColor       =   &H80000008& 
               Height          =   195 
               Left            =   255 
               TabIndex        =   26 
               Top             =   210 
               Value           =   1  'Checked 
               Width           =   1200 
            End 
            Begin VB.CommandButton CmdDel  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   150 
               Picture         =   "FrmStudentb.frx":0088 
               Style           =   1  'Graphical 
               TabIndex        =   25 
               ToolTipText     =   "删除该学生" 
               Top             =   840 
               Width           =   645 
            End 
            Begin VB.CommandButton CmdEdit  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   885 
               Picture         =   "FrmStudentb.frx":0117 
               Style           =   1  'Graphical 
               TabIndex        =   24 
               ToolTipText     =   "编辑考生信息" 
               Top             =   465 
               Width           =   645 
            End 
            Begin VB.CommandButton CmdNew  
               Appearance      =   0  'Flat 
               Height          =   300 
               Left            =   150 
               Picture         =   "FrmStudentb.frx":01A1 
               Style           =   1  'Graphical 
               TabIndex        =   23 
               ToolTipText     =   "添加考生信息" 
               Top             =   465 
               Width           =   645 
            End 
         End 
         Begin VB.Frame FramIn  
            Enabled         =   0   'False 
            Height          =   1305 
            Left            =   135 
            TabIndex        =   2 
            Top             =   255 
            Width           =   7080 
            Begin VB.TextBox TxTClass  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   5520 
               Locked          =   -1  'True 
               TabIndex        =   20 
               Text            =   "1" 
               Top             =   825 
               Width           =   285 
            End 
            Begin MSComCtl2.UpDown UDYear  
               Height          =   315 
               Left            =   6105 
               TabIndex        =   19 
               Top             =   330 
               Width           =   270 
               _ExtentX        =   476 
               _ExtentY        =   556 
               _Version        =   393216 
               Value           =   1997 
               BuddyControl    =   "TXTYear" 
               BuddyDispid     =   196619 
               OrigLeft        =   6645 
               OrigTop         =   315 
               OrigRight       =   6915 
               OrigBottom      =   645 
               Max             =   3000 
               Min             =   1990 
               SyncBuddy       =   -1  'True 
               BuddyProperty   =   65547 
               Enabled         =   -1  'True 
            End 
            Begin VB.TextBox TXTYear  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   5445 
               Locked          =   -1  'True 
               TabIndex        =   18 
               Text            =   "1997" 
               Top             =   330 
               Width           =   645 
            End 
            Begin VB.TextBox TXTName  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   1080 
               MaxLength       =   10 
               TabIndex        =   7 
               Top             =   360 
               Width           =   1200 
            End 
            Begin VB.TextBox TXTCode  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   1080 
               MaxLength       =   12 
               TabIndex        =   6 
               Top             =   840 
               Width           =   1185 
            End 
            Begin VB.TextBox TXTpass  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   12 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               IMEMode         =   3  'DISABLE 
               Left            =   3210 
               MaxLength       =   20 
               TabIndex        =   5 
               Top             =   825 
               Width           =   1305 
            End 
            Begin VB.OptionButton OptNv  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               Caption         =   "女" 
               ForeColor       =   &H00FF0000& 
               Height          =   210 
               Left            =   3960 
               TabIndex        =   4 
               Top             =   390 
               Width           =   435 
            End 
            Begin VB.OptionButton OptNan  
               Appearance      =   0  'Flat 
               BackColor       =   &H00E8F4F8& 
               Caption         =   "男" 
               ForeColor       =   &H00FF0000& 
               Height          =   210 
               Left            =   3270 
               TabIndex        =   3 
               Top             =   390 
               Value           =   -1  'True 
               Width           =   525 
            End 
            Begin MSComCtl2.UpDown UDClass  
               Height          =   330 
               Left            =   5820 
               TabIndex        =   21 
               Top             =   810 
               Width           =   270 
               _ExtentX        =   476 
               _ExtentY        =   582 
               _Version        =   393216 
               Value           =   1 
               BuddyControl    =   "TxTClass" 
               BuddyDispid     =   196618 
               OrigLeft        =   6645 
               OrigTop         =   315 
               OrigRight       =   6915 
               OrigBottom      =   645 
               Max             =   20 
               Min             =   1 
               SyncBuddy       =   -1  'True 
               BuddyProperty   =   0 
               Enabled         =   -1  'True 
            End 
            Begin VB.Line Line1  
               BorderWidth     =   2 
               X1              =   3840 
               X2              =   3840 
               Y1              =   360 
               Y2              =   630 
            End 
            Begin VB.Label Label2  
               Caption         =   "姓名:" 
               Height          =   240 
               Left            =   495 
               TabIndex        =   13 
               Top             =   420 
               Width           =   600 
            End 
            Begin VB.Label Label5  
               AutoSize        =   -1  'True 
               Caption         =   "入学年号" 
               Height          =   180 
               Left            =   4680 
               TabIndex        =   12 
               Top             =   405 
               Width           =   720 
            End 
            Begin VB.Label Label6  
               AutoSize        =   -1  'True 
               Caption         =   "班别:" 
               Height          =   180 
               Left            =   4965 
               TabIndex        =   11 
               Top             =   885 
               Width           =   540 
            End 
            Begin VB.Label Label3  
               Caption         =   "性别:" 
               Height          =   240 
               Left            =   2670 
               TabIndex        =   10 
               Top             =   390 
               Width           =   540 
            End 
            Begin VB.Label Label7  
               AutoSize        =   -1  'True 
               Caption         =   "学号:" 
               Height          =   180 
               Left            =   465 
               TabIndex        =   9 
               Top             =   930 
               Width           =   540 
            End 
            Begin VB.Label Label8  
               Caption         =   "登陆密码:" 
               Height          =   315 
               Left            =   2325 
               TabIndex        =   8 
               Top             =   900 
               Width           =   915 
            End 
            Begin VB.Shape Shape1  
               BackColor       =   &H00E8F4F8& 
               FillColor       =   &H00FFFFFF& 
               FillStyle       =   0  'Solid 
               Height          =   315 
               Left            =   3210 
               Top             =   330 
               Width           =   1335 
            End 
         End 
         Begin MSComCtl2.UpDown UpDown1  
            Height          =   315 
            Left            =   3600 
            TabIndex        =   14 
            Top             =   510 
            Width           =   270 
            _ExtentX        =   476 
            _ExtentY        =   556 
            _Version        =   393216 
            Value           =   1995 
            BuddyControl    =   "CmdDel" 
            BuddyDispid     =   196614 
            OrigLeft        =   5445 
            OrigTop         =   315 
            OrigRight       =   5715 
            OrigBottom      =   645 
            Max             =   3000 
            Min             =   1990 
            SyncBuddy       =   -1  'True 
            BuddyProperty   =   65547 
            Enabled         =   -1  'True 
         End 
      End 
      Begin MSComctlLib.TreeView Tr  
         Height          =   7215 
         Left            =   90 
         TabIndex        =   15 
         Top             =   495 
         Width           =   2595 
         _ExtentX        =   4577 
         _ExtentY        =   12726 
         _Version        =   393217 
         Indentation     =   176 
         LabelEdit       =   1 
         LineStyle       =   1 
         Style           =   7 
         BorderStyle     =   1 
         Appearance      =   0 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "年级班级情况:" 
         Height          =   180 
         Left            =   180 
         TabIndex        =   16 
         Top             =   225 
         Width           =   1260 
      End 
   End 
   Begin MSComctlLib.ImageList ImgLst  
      Left            =   3330 
      Top             =   7785 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   20 
      ImageHeight     =   20 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   7 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":020F 
            Key             =   "save" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":02A3 
            Key             =   "undo" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":0313 
            Key             =   "new" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":0393 
            Key             =   "edit" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":042F 
            Key             =   "student" 
         EndProperty 
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":0883 
            Key             =   "grade" 
         EndProperty 
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudentb.frx":0CD7 
            Key             =   "class" 
         EndProperty 
      EndProperty 
   End 
End 
Attribute VB_Name = "FrmStudent" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
'标志是添加还是编辑 
Dim NewOrEdit As String 
 
'设置是否可以编辑 
Sub SetEnabled(ByVal TF As Boolean) 
  Tr.Enabled = Not TF 
  DGKaoSheng.Enabled = Not TF 
  FramIn.Enabled = TF 
  CmdDel.Enabled = Not TF 
End Sub 
'清空 
Sub ClsXS() 
  TXTName = "" 
  TXTName.SetFocus 
 ' TXTgrade = "" 
  'TXTclass = "" 
  TXTCode = "" 
  TXTPass = "" 
End Sub 
'判断输入是否合格 
Function CheckIn() As Boolean 
  If TXTName = "" Then 
    MsgBox "请输入学生的姓名!" 
    TXTName.SetFocus 
    Exit Function 
  End If 
  If TXTCode.Text = "" Then 
    MsgBox "请输入学生的学号!这个学号将用于考试的时候登录!" 
    TXTCode.SetFocus 
    Exit Function 
  End If 
   
  
 CheckIn = True 
End Function 
 
Private Sub CmdDel_Click() 
 Dim answer As String 
 If DGKaoSheng.ApproxCount = 0 Then 
 MsgBox "你还没有选中要删除的记录呢!", vbExclamation, "提示" 
 Exit Sub 
 End If 
 '检查成绩库里面是否已经有这个学生的记录 
 Dim adoRs As Recordset 
 Set adoRs = New Recordset 
 adoRs.Open "select id from score where studentid=" + DGKaoSheng.Columns(0).Text, DB, adOpenStatic, adLockOptimistic 
 If adoRs.RecordCount > 0 Then 
   MsgBox "成绩库里有这个学生的记录,你如果要删除这个学生的信息,请先删除这个学生的成绩记录!" 
   Set adoRs = Nothing 
   Exit Sub 
 End If 
 Set adoRs = Nothing 
 answer = MsgBox("你确定要删除此记录吗?", vbExclamation + vbYesNo, "系统提示") 
 If answer = vbNo Then 
 Exit Sub 
 Else 
 Dim sql As String 
 sql = "delete from kaosheng where id=" + DGKaoSheng.Columns(0).Text 
 DB.Execute sql 
 '更新显示 
 sql = "select id as ID值,code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 班号,pass as 登陆密码 from kaosheng where ryear=" + TXTYear.Text + " and class=" + TxTClass.Text 
 FillList sql 
 ClearTXT 
 End If 
End Sub 
 
Private Sub CmdEdit_Click() 
 
 If CmdNew.ToolTipText = "添加考生信息" Then 
  If DGKaoSheng.Row < 0 Then 
    MsgBox "请选择你要修改的学生!" 
    Exit Sub 
  End If 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存考生信息" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "Edit" 
   
 Else 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加考生信息" 
  CmdEdit.ToolTipText = "编辑考生信息" 
 End If 
 
End Sub 
 
Private Sub CmdExit_Click() 
 Unload Me 
End Sub 
 
Private Sub CmdNew_Click() 
 If CmdNew.ToolTipText = "添加考生信息" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存考生信息" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "New" 
  If CheQK.Value = 1 Then 
    '清空 
    ClsXS 
  End If 
 Else 
   
    '判断输入是否合格 
    If CheckIn = False Then 
       Exit Sub 
    End If 
     
    Dim sql As String 
    Dim Sex As String 
    Dim TempadoRs As Recordset 
    Set TempadoRs = New Recordset 
    sql = "select id as ID值,code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 班号,pass as 登陆密码 from kaosheng where ryear=" + TXTYear.Text + " and class=" + TxTClass.Text 
    Sex = "男" 
    If OptNv.Value = True Then Sex = "女" 
      
      
     '判断是添加还是编辑 
        
  If NewOrEdit = "New" Then 
    '添加 
       '检查学号是否已经存在 
    TempadoRs.Open "select id from kaosheng where code='" + TXTCode.Text + "'", DB, adOpenStatic, adLockOptimistic 
    If TempadoRs.RecordCount > 0 Then 
       MsgBox "对不起,这个学号的学生已经存在,请输入另一个学号!" 
       TXTCode.SetFocus 
       SendKeys "{Home}+{End}" 
       Set TempadoRs = Nothing 
       Exit Sub 
    End If 
    Set TempadoRs = Nothing 
   
      Dim StudentNew As Recordset 
      Set StudentNew = New Recordset 
      StudentNew.Open "kaosheng", DB, adOpenStatic, adLockOptimistic 
      StudentNew.AddNew 
      StudentNew.Fields("id") = GetAutoID("kaosheng") 
      StudentNew.Fields("name") = TXTName 
      StudentNew.Fields("sex") = Sex 
      StudentNew.Fields("ryear") = TXTYear.Text 
      StudentNew.Fields("class") = TxTClass.Text 
      StudentNew.Fields("code") = TXTCode.Text 
      StudentNew.Fields("pass") = TXTPass 
      StudentNew.Update 
      StudentNew.Close 
      FillList (sql) 
    Else 
      '检查学号是否已经存在 
     TempadoRs.Open "select id from kaosheng where code='" + TXTCode.Text + "' and id<>" + DGKaoSheng.Columns(0).Text, DB, adOpenStatic, adLockOptimistic 
     If TempadoRs.RecordCount > 0 Then 
       MsgBox "对不起,这个学号的学生已经存在,请输入另一个学号!" 
       TXTCode.SetFocus 
       SendKeys "{Home}+{End}" 
       Set TempadoRs = Nothing 
       Exit Sub 
     End If 
     Set TempadoRs = Nothing 
     '更新 
     Dim sql1 As String 
     sql1 = "update kaosheng set name='" + TXTName + "',sex='" + Sex + "',code='" + TXTCode.Text + "',ryear=" + TXTYear.Text + ",class=" + TxTClass.Text + " where id=" & DGKaoSheng.Columns(0).Text 
     DB.Execute sql1 
     '更新显示 
     FillList (sql) 
  End If 
   ' ClearTXT 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加考生信息" 
  CmdEdit.ToolTipText = "编辑考生信息" 
 End If 
 
End Sub 
 
Private Sub DGKaoSheng_RowColChange(LastRow As Variant, ByVal LastCol As Integer) 
  If DGKaoSheng.ApproxCount <= 0 Then Exit Sub 
  TXTCode.Text = DGKaoSheng.Columns(1).Text 
  TXTName.Text = DGKaoSheng.Columns(2).Text 
  If DGKaoSheng.Columns(3).Text = "男" Then 
     OptNan.Value = True 
    Else 
     OptNv.Value = True 
  End If 
  TXTYear.Text = DGKaoSheng.Columns(4).Text 
  TxTClass.Text = DGKaoSheng.Columns(5).Text 
End Sub 
 
Private Sub Form_Load() 
    Dim sql As String 
     
    '产生树型结构 
    createTree 
   '显示所有考生 
    sql = "select id as ID值,code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 班号,pass as 登陆密码 from kaosheng" 
    FillList sql 
End Sub 
'填充列表 
Sub FillList(sql As String) 
Dim KaoShengRS As Recordset 
Set KaoShengRS = New Recordset 
KaoShengRS.Open sql, DB, adOpenStatic, adLockOptimistic 
Set DGKaoSheng.DataSource = KaoShengRS 
DGKaoSheng_RowColChange 0, 0 
End Sub 
 
Sub createTree() 
    Dim i As Integer 
    Dim nodeR As Node 
    Dim adoRsNJ As Recordset 
    Set adoRsNJ = New Recordset 
    adoRsNJ.Open "select * from nianji", DB, adOpenStatic, adLockOptimistic 
    If adoRsNJ.EOF = True Then 
       MsgBox "学校的年级信息不完整,请先配置年级信息!" 
       Exit Sub 
    End If 
    Do While Not adoRsNJ.EOF 
      '生成年级节点 
      Set nodeR = Tr.Nodes.Add(, , "root_" + Int2Str(adoRsNJ.Fields("xuhao").Value) + "|" + Int2Str(adoRsNJ.Fields("id").Value), adoRsNJ.Fields("name").Value) 
      For i = 1 To adoRsNJ.Fields("banshu").Value 
         Set nodeR = Tr.Nodes.Add("root_" + Int2Str(adoRsNJ.Fields("xuhao").Value) + "|" + Int2Str(adoRsNJ.Fields("id").Value), tvwChild, Int2Str(adoRsNJ.Fields("xuhao").Value) + "_" + Int2Str(adoRsNJ.Fields("id").Value) + "_" + Int2Str(i), Int2Str(i) + "班") 
      Next i 
      adoRsNJ.MoveNext 
    Loop 
    
End Sub 
 
 
 
Private Sub ClearTXT() 
TXTName.Text = "" 
TXTPass.Text = "" 
TXTCode.Text = "" 
 
 
End Sub 
 
 
Private Sub Tr_NodeClick(ByVal Node As MSComctlLib.Node) 
   'MsgBox Node.Key 
   Dim YearNum As Integer 
   Dim ClassNum As Integer 
   Dim sql As String 
   If Left(Node.Key, 5) = "root_" Then 
      YearNum = Num2Year(Val(Mid(Node.Key, 6))) 
      TXTYear.Text = YearNum 
      sql = "select id as ID值,code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 班号,pass as 登陆密码 from kaosheng where ryear=" + Int2Str(YearNum) 
      FillList sql 
    Else 
      YearNum = Num2Year(Val(Node.Key)) 
      ClassNum = Val(Node.Text) 
      TXTYear.Text = YearNum 
      TxTClass.Text = ClassNum 
      sql = "select id as ID值,code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 班号,pass as 登陆密码 from kaosheng where ryear=" + Int2Str(YearNum) + " and class=" + Int2Str(ClassNum) 
      FillList sql 
 
   End If 
       
End Sub 
 
 
Private Sub TXTCode_KeyPress(KeyAscii As Integer) 
    If KeyAscii = 39 Then KeyAscii = -24145 
 
End Sub 
 
Private Sub TXTName_KeyPress(KeyAscii As Integer) 
   If KeyAscii = 39 Then KeyAscii = -24145 
 
End Sub 
 
Private Sub TXTpass_KeyPress(KeyAscii As Integer) 
   If KeyAscii = 39 Then KeyAscii = -24145 
 
End Sub