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


VERSION 5.00 
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX" 
Begin VB.Form Form4  
   Caption         =   "学生基本信息查询" 
   ClientHeight    =   6495 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   9315 
   Icon            =   "baseselect.frx":0000 
   LinkTopic       =   "Form4" 
   ScaleHeight     =   6495 
   ScaleWidth      =   9315 
   StartUpPosition =   2  '屏幕中心 
   Begin MSFlexGridLib.MSFlexGrid grid1  
      Height          =   5055 
      Left            =   120 
      TabIndex        =   8 
      Top             =   900 
      Width           =   8955 
      _ExtentX        =   15796 
      _ExtentY        =   8916 
      _Version        =   393216 
      Rows            =   1000 
      Cols            =   15 
      FixedCols       =   0 
      BackColor       =   -2147483624 
      ForeColor       =   -2147483625 
      FormatString    =   $"baseselect.frx":08CA 
   End 
   Begin VB.CommandButton Command3  
      Caption         =   "退出(&Q)" 
      Height          =   375 
      Left            =   8370 
      TabIndex        =   7 
      Top             =   6090 
      Width           =   885 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "打印(&P)" 
      Height          =   375 
      Left            =   7410 
      TabIndex        =   6 
      Top             =   6090 
      Width           =   975 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "查询条件" 
      Height          =   645 
      Left            =   150 
      TabIndex        =   0 
      Top             =   180 
      Width           =   7335 
      Begin VB.CommandButton Command1  
         Caption         =   "查询(&S)" 
         BeginProperty Font  
            Name            =   "宋体" 
            Size            =   9 
            Charset         =   134 
            Weight          =   700 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         Height          =   375 
         Left            =   6060 
         TabIndex        =   5 
         Top             =   180 
         Width           =   1185 
      End 
      Begin VB.ComboBox Combo1  
         Enabled         =   0   'False 
         Height          =   300 
         Left            =   3780 
         TabIndex        =   4 
         Top             =   210 
         Width           =   1755 
      End 
      Begin VB.OptionButton Option2  
         Caption         =   "班级:" 
         Height          =   315 
         Left            =   2760 
         TabIndex        =   3 
         Top             =   210 
         Width           =   1035 
      End 
      Begin VB.TextBox Text1  
         Height          =   315 
         Left            =   990 
         TabIndex        =   2 
         Top             =   210 
         Width           =   1515 
      End 
      Begin VB.OptionButton Option1  
         Caption         =   "学号:" 
         Height          =   435 
         Left            =   210 
         TabIndex        =   1 
         Top             =   150 
         Width           =   2475 
      End 
   End 
End 
Attribute VB_Name = "Form4" 
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() 
  If Option1.Value Then 
     If Text1.Text = "" Then 
         MsgBox "请输入条件!" 
         Exit Sub 
     End If 
     If De1.rsComm1.State = 1 Then De1.rsComm1.Close 
     De1.rsComm1.Open "select * from 基本表 where 学号='" & Text1.Text & "'", cnn, adOpenKeyset, adLockPessimistic 
     Call baseselect(De1.rsComm1, grid1) 
 End If 
 If Option2.Value Then 
     If Combo1.Text = "" Then 
        MsgBox "请输入条件!" 
        Exit Sub 
     End If 
     If De1.rsComm1.State = 1 Then De1.rsComm1.Close 
     De1.rsComm1.Open "select * from 基本表 where 班级='" & Combo1.Text & "'", cnn, adOpenKeyset, adLockPessimistic 
     Call baseselect(De1.rsComm1, grid1) 
 
End If 
End Sub 
 
Private Sub Command2_Click() 
     If De1.rsComm1.RecordCount = 0 Then Exit Sub 
     DataReport1.Show 1 
End Sub 
 
Private Sub Command3_Click() 
   Unload Form4 
End Sub 
 
Private Sub Command4_Click() 
 
End Sub 
 
Private Sub Form_Load() 
  If rs.State = 1 Then rs.Close 
  rs.Open "select 班级 from 班级表", cnn, adOpenKeyset, adLockPessimistic 
  If rs.RecordCount <> 0 Then 
     Combo1.Clear 
     Do While Not rs.EOF 
        Combo1.additem rs.Fields("班级") 
        rs.MoveNext 
    Loop 
 End If 
  If rs.State = 1 Then rs.Close 
  rs.Open "select * from 基本表", cnn, adOpenKeyset, adLockPessimistic 
  Call baseselect(rs, grid1) 
End Sub 
 
Private Sub Option1_Click() 
  If Option1.Value Then 
     Text1.Enabled = True 
     Combo1.Enabled = False 
  Else 
     Text1.Enabled = False 
     Combo1.Enabled = True 
  End If 
End Sub 
 
Private Sub Option2_Click() 
  If Option2.Value Then 
     Combo1.Enabled = True 
     Text1.Enabled = False 
  Else 
     Combo1.Enabled = False 
     Text1.Enabled = True 
  End If 
End Sub