www.pudn.com > new xsc.rar > frmbanji.frm


VERSION 5.00 
Begin VB.Form frmbanji  
   Caption         =   "设置班级" 
   ClientHeight    =   3195 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   4680 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MDIChild        =   -1  'True 
   ScaleHeight     =   3195 
   ScaleWidth      =   4680 
   Begin VB.CommandButton Command2  
      Caption         =   "取消" 
      Height          =   495 
      Left            =   2520 
      TabIndex        =   5 
      Top             =   2160 
      Width           =   975 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确定" 
      Height          =   495 
      Left            =   1080 
      TabIndex        =   4 
      Top             =   2160 
      Width           =   975 
   End 
   Begin VB.TextBox Text2  
      Height          =   375 
      Left            =   2160 
      TabIndex        =   3 
      Top             =   1200 
      Width           =   1455 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Left            =   2160 
      TabIndex        =   1 
      Top             =   480 
      Width           =   1455 
   End 
   Begin VB.Label Label2  
      AutoSize        =   -1  'True 
      Caption         =   "班级人数:" 
      Height          =   180 
      Left            =   720 
      TabIndex        =   2 
      Top             =   1320 
      Width           =   900 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "班级名称:" 
      Height          =   180 
      Left            =   720 
      TabIndex        =   0 
      Top             =   600 
      Width           =   900 
   End 
End 
Attribute VB_Name = "frmbanji" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Private Sub Command1_Click() 
  Dim mr As ADODB.Recordset 
  Dim msgtext As String 
  If Trim(Text1.Text & "") = "" Then 
    MsgBox "请输入班级名称!", vbOKOnly + vbExclamation, "警告" 
    Text1.SetFocus 
     Exit Sub 
  End If 
  If Trim(Text2.Text & "") = "" Then 
    MsgBox "请输入班级人数!", vbOKOnly + vbExclamation, "警告" 
    Text2.SetFocus 
     Exit Sub 
  End If 
  If Not IsNumeric(Trim(Text2.Text)) Then 
     MsgBox "班级人数必须为数字!", vbOKOnly + vbExclamation, "警告" 
     Text2.SetFocus 
     Exit Sub 
  End If 
  txtSQL = "select * from class where id='" & Trim(Text1.Text) & "'" 
  Set mr = ExecuteSQL(txtSQL, msgtext) 
  If mr.EOF = False Then 
    MsgBox "已经存在该班级,如需要改动请执行修改班级操作!", vbOKOnly + vbExclamation, "警告" 
    Text1.Text = "'" 
    Text2.Text = "" 
    Exit Sub 
  End If 
  mr.Close 
  txtSQL = "execute addbanji'" 
  txtSQL = txtSQL & Trim(Text1.Text) & "','" 
  txtSQL = txtSQL & Trim(Text2.Text) & "'" 
  Set mr = ExecuteSQL(txtSQL, msgtext) 
  Text1.Text = "" 
  Text2.Text = "" 
  MsgBox "纪录添加成功!", vbOKOnly + vbExclamation, "提示" 
End Sub 
 
Private Sub Command2_Click() 
  Unload Me 
   
End Sub 
 
Private Sub Form_Load() 
  Me.Height = 3600 
  Me.Width = 4800 
  Me.Top = frmmdi.Height / 2 - 2400 
  Me.Left = frmmdi.Width / 2 - 2400 
End Sub