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


VERSION 5.00 
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX" 
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" 
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "CRYSTL32.OCX" 
Begin VB.Form FrmSeach  
   Caption         =   "系统信息查询" 
   ClientHeight    =   8595 
   ClientLeft      =   495 
   ClientTop       =   345 
   ClientWidth     =   11880 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   ScaleHeight     =   8595 
   ScaleWidth      =   11880 
   WindowState     =   2  'Maximized 
   Begin VB.Frame Frame6  
      Caption         =   "考生查询结果" 
      Height          =   7770 
      Left            =   165 
      TabIndex        =   0 
      Top             =   135 
      Width           =   11415 
      Begin Crystal.CrystalReport CRp  
         Left            =   8310 
         Top             =   5205 
         _ExtentX        =   741 
         _ExtentY        =   741 
         _Version        =   262150 
         WindowControlBox=   -1  'True 
         WindowMaxButton =   -1  'True 
         WindowMinButton =   -1  'True 
         PrintFileType   =   7 
      End 
      Begin VB.Frame Frame1  
         Caption         =   "操作" 
         Height          =   2670 
         Left            =   8010 
         TabIndex        =   20 
         Top             =   4875 
         Width           =   3270 
         Begin VB.CommandButton Command1  
            Caption         =   "删除学生" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   420 
            Left            =   180 
            TabIndex        =   24 
            Top             =   1575 
            Width           =   1350 
         End 
         Begin VB.CommandButton Command2  
            Caption         =   "关   闭" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   420 
            Left            =   1770 
            TabIndex        =   23 
            Top             =   1575 
            Width           =   1440 
         End 
         Begin VB.CommandButton CmdPrint  
            Caption         =   "打印准考证" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   420 
            Left            =   1740 
            TabIndex        =   22 
            Top             =   825 
            Width           =   1440 
         End 
         Begin VB.CommandButton Command3  
            Caption         =   "查   询" 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   420 
            Left            =   180 
            TabIndex        =   21 
            Top             =   825 
            Width           =   1350 
         End 
      End 
      Begin VB.Frame Frame5  
         Caption         =   "学生查询条件" 
         Height          =   4560 
         Left            =   8010 
         TabIndex        =   2 
         Top             =   225 
         Width           =   3270 
         Begin VB.TextBox TXTCode  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   315 
            Left            =   2025 
            TabIndex        =   14 
            Top             =   300 
            Width           =   990 
         End 
         Begin VB.TextBox TXTName  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   315 
            Left            =   375 
            TabIndex        =   13 
            Top             =   1275 
            Width           =   1755 
         End 
         Begin VB.ComboBox CmbNianJi  
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmSeach.frx":0000 
            Left            =   765 
            List            =   "FrmSeach.frx":0010 
            Style           =   2  'Dropdown List 
            TabIndex        =   12 
            Top             =   1875 
            Width           =   1425 
         End 
         Begin VB.OptionButton OptNv  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            Caption         =   "女" 
            ForeColor       =   &H00FF0000& 
            Height          =   210 
            Left            =   2115 
            TabIndex        =   11 
            Top             =   3345 
            Width           =   435 
         End 
         Begin VB.OptionButton OptNan  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            Caption         =   "男" 
            ForeColor       =   &H00FF0000& 
            Height          =   210 
            Left            =   1605 
            TabIndex        =   10 
            Top             =   3345 
            Width           =   525 
         End 
         Begin VB.OptionButton OptAllMan  
            Appearance      =   0  'Flat 
            BackColor       =   &H00E8F4F8& 
            Caption         =   "所有" 
            ForeColor       =   &H00FF0000& 
            Height          =   210 
            Left            =   960 
            TabIndex        =   9 
            Top             =   3345 
            Value           =   -1  'True 
            Width           =   660 
         End 
         Begin VB.ComboBox CmbCZF  
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmSeach.frx":0026 
            Left            =   330 
            List            =   "FrmSeach.frx":0036 
            Style           =   2  'Dropdown List 
            TabIndex        =   8 
            Top             =   315 
            Width           =   750 
         End 
         Begin VB.ComboBox CmbClass  
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmSeach.frx":0047 
            Left            =   810 
            List            =   "FrmSeach.frx":0057 
            Style           =   2  'Dropdown List 
            TabIndex        =   7 
            Top             =   2580 
            Width           =   915 
         End 
         Begin VB.CheckBox CheYear  
            Caption         =   "入学年份" 
            Height          =   210 
            Left            =   225 
            TabIndex        =   6 
            Top             =   4095 
            Width           =   1035 
         End 
         Begin VB.ComboBox CmbCZY  
            BackColor       =   &H00E8F4F8& 
            BeginProperty Font  
               Name            =   "宋体" 
               Size            =   10.5 
               Charset         =   134 
               Weight          =   400 
               Underline       =   0   'False 
               Italic          =   0   'False 
               Strikethrough   =   0   'False 
            EndProperty 
            Height          =   330 
            ItemData        =   "FrmSeach.frx":006D 
            Left            =   1260 
            List            =   "FrmSeach.frx":007D 
            Style           =   2  'Dropdown List 
            TabIndex        =   5 
            Top             =   4020 
            Width           =   750 
         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            =   2010 
            Locked          =   -1  'True 
            TabIndex        =   4 
            Text            =   "2001" 
            Top             =   4035 
            Width           =   570 
         End 
         Begin MSComCtl2.UpDown UDYear  
            Height          =   315 
            Left            =   2595 
            TabIndex        =   3 
            Top             =   4035 
            Width           =   270 
            _ExtentX        =   476 
            _ExtentY        =   556 
            _Version        =   393216 
            Value           =   2001 
            BuddyControl    =   "TXTYear" 
            BuddyDispid     =   196626 
            OrigLeft        =   2595 
            OrigTop         =   4035 
            OrigRight       =   2865 
            OrigBottom      =   4365 
            Max             =   3000 
            Min             =   1900 
            SyncBuddy       =   -1  'True 
            BuddyProperty   =   0 
            Enabled         =   -1  'True 
         End 
         Begin VB.Label Label1  
            AutoSize        =   -1  'True 
            Caption         =   "学生学号" 
            Height          =   180 
            Index           =   8 
            Left            =   1275 
            TabIndex        =   19 
            Top             =   390 
            Width           =   720 
         End 
         Begin VB.Label Label4  
            Caption         =   "姓名(支持模糊查询):" 
            Height          =   165 
            Left            =   285 
            TabIndex        =   18 
            Top             =   1005 
            Width           =   1800 
         End 
         Begin VB.Label Label1  
            BackStyle       =   0  'Transparent 
            Caption         =   "级别:" 
            Height          =   165 
            Index           =   11 
            Left            =   285 
            TabIndex        =   17 
            Top             =   1965 
            Width           =   540 
         End 
         Begin VB.Label Label1  
            BackStyle       =   0  'Transparent 
            Caption         =   "班别:" 
            Height          =   165 
            Index           =   12 
            Left            =   255 
            TabIndex        =   16 
            Top             =   2670 
            Width           =   540 
         End 
         Begin VB.Label Label5  
            Caption         =   "性别:" 
            Height          =   240 
            Left            =   285 
            TabIndex        =   15 
            Top             =   3375 
            Width           =   540 
         End 
         Begin VB.Shape Shape2  
            BackColor       =   &H00E8F4F8& 
            FillColor       =   &H00FFFFFF& 
            FillStyle       =   0  'Solid 
            Height          =   315 
            Left            =   855 
            Top             =   3285 
            Width           =   1815 
         End 
      End 
      Begin MSDataGridLib.DataGrid DGKS  
         Height          =   7275 
         Left            =   90 
         TabIndex        =   1 
         Top             =   270 
         Width           =   7740 
         _ExtentX        =   13653 
         _ExtentY        =   12832 
         _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 
   End 
End 
Attribute VB_Name = "FrmSeach" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
  
Private Sub Command1_Click() 
  Dim sql As String 
  If MsgBox("执行这个动作将会产生很严重的后果!你是否真的执行?", vbYesNo, "警告!") = vbYes Then 
     If MsgBox("这将会删除你所查询的学生的信息!而已还会删除他们的所有成绩!是否真的执行?", vbYesNo, "警告!") = vbYes Then 
       Dim adoRs As Recordset 
       Set adoRs = New Recordset 
       Dim IdStr As String 
       adoRs.Open "select score.id from score,kaosheng where kaosheng.id=score.studentid" + GetTJStr(), DB, adOpenStatic, adLockOptimistic 
       Do While Not adoRs.EOF 
         IdStr = IdStr & adoRs.Fields(0).Value & "," 
         adoRs.MoveNext 
       Loop 
       If IdStr = "" Then IdStr = "," 
       IdStr = Left(IdStr, Len(IdStr) - 1) 
       If IdStr <> "" Then 
         sql = "delete from score where id in(" + IdStr + ")" 
         DB.Execute sql 
         sql = "delete from scoretk where id in(" + IdStr + ")" 
         DB.Execute sql 
         sql = "delete from scorewd where id in(" + IdStr + ")" 
         DB.Execute sql 
         sql = "delete from scorezw where id in(" + IdStr + ")" 
         DB.Execute sql 
         sql = "delete from scorepd where id in(" + IdStr + ")" 
         DB.Execute sql 
      End If 
       sql = "delete from kaosheng" + " where name like '%%'" + GetTJStr() 
       DB.Execute sql 
     '刷新 
      Command3_Click 
     End If 
  End If 
End Sub 
 
Private Sub CmdPrint_Click() 
  ' Dim KSStr As String 
  '' Dim i As Integer 
  ' For i = 0 To DGKS.ApproxCount - 1 
  '    DGKS.Row = i 
  '    KSStr = KSStr + DGKS.Columns(0).Text + "," 
       
   'Next i 
   'KSStr = Left(KSStr, Len(KSStr) - 1) 
   CRp.ReportFileName = App.Path + "\rpt\zkz.rpt" 
   CRp.SelectionFormula = "{kaosheng.code}='" + DGKS.Columns(0).Text + "'" 
   'CRp.SelectionFormula = "{kaosheng.code} in (" + KSStr + ")" 
   CRp.WindowState = crptMaximized 
   CRp.WindowTitle = "准考证打印预览" 
   CRp.PrintReport 
End Sub 
 
Private Sub Command2_Click() 
  Unload Me 
End Sub 
'得到条件字符串 
Function GetTJStr() As String 
  '定义查询条件,保存各个查询条件 
 Dim SqlXueHao As String 
 Dim SqlName As String 
 Dim SqlNianJi As String 
 Dim SqlClass As String 
 Dim SqlSex As String 
 Dim SqlYear As String 
 Dim TempRs As Recordset 
 Set TempRs = New Recordset 
 '设置编号查询条件 
 If TXTCode.Text <> "" Then 
   SqlXueHao = " and code" + CmbCZF.Text + "'" + TXTCode.Text + "'" 
  Else 
   SqlXueHao = "" 
 End If 
 '设置姓名关键字 
 If TXTName.Text <> "" Then 
   SqlName = " and name like '%" + TXTName.Text + "%'" 
  Else 
   SqlName = "" 
 End If 
 '设置姓别 
 If OptAllMan.Value = True Then 
   SqlSex = "" 
  ElseIf OptNan.Value = True Then 
   SqlSex = " and sex='男'" 
  Else 
   SqlSex = " and sex='女'" 
 End If 
 '设置年级 
 If CmbNianJi.ListIndex = 0 Then 
    SqlNianJi = "" 
   Else 
    Dim YearNum As Integer 
    TempRs.Open "select xuhao from nianji where name='" + CmbNianJi.Text + "'", DB, adOpenStatic, adLockOptimistic 
    YearNum = Num2Year(TempRs.Fields(0).Value) 
    TempRs.Close 
    SqlNianJi = " and ryear=" + Int2Str(YearNum) 
 End If 
 '设置班号 
 SqlClass = " and class=" + Int2Str(CmbClass.ListIndex) 
 If CmbClass.ListIndex = 0 Then 
    SqlClass = "" 
 End If 
 '设置入学年条件 
 If CheYear.Value = 1 Then 
    SqlYear = " and ryear" + CmbCZY.Text + TXTYear.Text 
   Else 
    SqlYear = "" 
 End If 
 GetTJStr = SqlXueHao + SqlName + SqlSex + SqlNianJi + SqlClass + SqlYear 
End Function 
 
Private Sub Command3_Click() 
 Dim adoRs As Recordset 
 Dim sql As String 
 Set adoRs = New Recordset 
  
 '========================================== 
 sql = "select code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 所在班号 from kaosheng" 
 sql = sql + " where name like '%%'" + GetTJStr() 
 adoRs.Open sql, DB, adOpenStatic, adLockOptimistic 
 Set DGKS.DataSource = adoRs 
End Sub 
 
Private Sub Form_Load() 
 Dim adoRs As Recordset 
 Set adoRs = New Recordset 
 Dim i As Integer 
 '添加分局到下拉框 
 adoRs.Open "nianji", DB, adOpenStatic, adLockOptimistic 
 CmbNianJi.Clear 
 CmbNianJi.AddItem "所有年级" 
 Do While Not adoRs.EOF 
   CmbNianJi.AddItem adoRs.Fields("name").Value 
   adoRs.MoveNext 
 Loop 
 adoRs.Close 
 '添加班号到下拉框 
 CmbClass.Clear 
 CmbClass.AddItem "所有班别" 
 For i = 1 To 25 
   CmbClass.AddItem Int2Str(i) + "班" 
 Next i 
  
 '设置初始值 
 CmbNianJi.ListIndex = 0 
 CmbClass.ListIndex = 0 
 CmbCZF.ListIndex = 0 
 CmbCZY.ListIndex = 0 
 '显示所有考生信息 
 Dim adoKsRS As Recordset 
 Set adoKsRS = New Recordset 
 adoKsRS.Open "select code as 学号,name as 姓名,sex as 性别,ryear as 入学年份,class as 所在班号 from kaosheng", DB, adOpenStatic, adLockOptimistic 
 Set DGKS.DataSource = adoKsRS 
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