⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmqueryappraise.frm

📁 数据库课程设计
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form frmQueryAppraise 
   Caption         =   "查询评价"
   ClientHeight    =   2865
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7320
   LinkTopic       =   "Form1"
   ScaleHeight     =   2865
   ScaleWidth      =   7320
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&N)"
      Height          =   375
      Left            =   5760
      TabIndex        =   5
      Top             =   720
      Width           =   1335
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "查询(&Y)"
      Height          =   375
      Left            =   5760
      TabIndex        =   4
      Top             =   240
      Width           =   1335
   End
   Begin MSFlexGridLib.MSFlexGrid fgAppraise 
      Height          =   1575
      Left            =   120
      TabIndex        =   3
      Top             =   1200
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   2778
      _Version        =   393216
   End
   Begin VB.Frame Frame1 
      Caption         =   "查询方式"
      Height          =   975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5415
      Begin VB.TextBox txtNo 
         Height          =   405
         Left            =   3360
         TabIndex        =   6
         Text            =   "Text1"
         Top             =   360
         Width           =   1935
      End
      Begin VB.OptionButton optQuery 
         Caption         =   "按员工编号查询"
         Height          =   375
         Index           =   1
         Left            =   1800
         TabIndex        =   2
         Top             =   360
         Width           =   1575
      End
      Begin VB.OptionButton optQuery 
         Caption         =   "查询全部"
         Height          =   375
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
   End
End
Attribute VB_Name = "frmQueryAppraise"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
queryAppraise
End Sub

Sub queryAppraise()
Dim rs As ADODB.Recordset
Dim i As Integer
Dim j As Integer

If optQuery(0).Value = True Then
    sqlStr = "select employeeBasic.name,appraise.employeeNo," _
    & "appraise.performance,appraise.level,appraise.attitude," _
    & "appraise.appraiser,appraise.appraiseDate from appraise," _
    & "employeeBasic where appraise.employeeNo=employeeBasic.employeeNo"
End If

If optQuery(1).Value = True Then
    sqlStr = "select employeeBasic.name,appraise.employeeNo," _
    & "appraise.performance,appraise.level,appraise.attitude," _
    & "appraise.appraiser,appraise.appraiseDate from appraise," _
    & "employeeBasic where appraise.employeeNo=employeeBasic.employeeNo" _
    & " AND appraise.employeeNo='" & txtNo.Text & "'"
End If


Set rs = ExecuteSQL(sqlStr, msgText)

If rs.RecordCount = 0 Then

    MsgBox "没有查找满足条件的数据!", vbExclamation, "提示"
    fgAppraise.Rows = 1
   
Else
    fgAppraise.Rows = rs.RecordCount + 1
    
    fgAppraise.Cols = 7
    
    
    '设定行高
    For i = 0 To fgAppraise.Rows - 1
       fgAppraise.RowHeight(i) = 280
    Next i
    
    '设定列的属性
    fgAppraise.Row = 0
    
    For i = 0 To fgAppraise.Cols - 1
       fgAppraise.Col = i  '指定当前列为第i列
       fgAppraise.FixedAlignment(i) = 4  '每列内容居中显示
       Select Case i
           Case 0
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "编号"
           Case 1
              fgAppraise.ColWidth(i) = 720  '设定列宽
              fgAppraise.Text = "姓名"
           Case 2
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "工作业绩"
           Case 3
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "工作态度"
           Case 4
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "工作水平"
           Case 5
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "评价日期"
           Case 6
              fgAppraise.ColWidth(i) = 1000  '设定列宽
              fgAppraise.Text = "评价人"
        End Select
           
    Next i
       
       
    'rs.MoveFirst
    
    i = 1
    
    While (Not rs.EOF)
    
       fgAppraise.Row = i
       For j = 0 To fgAppraise.Cols - 1
       
        fgAppraise.Col = j '设置当前为列为第j列
        fgAppraise.CellAlignment = 4  '每列内容居中显示
    
        
        Select Case j
            Case 0
               fgAppraise.Text = rs.Fields("employeeNo")
            Case 1
               fgAppraise.Text = rs.Fields("name")
            Case 2
               fgAppraise.Text = rs.Fields("performance")
            Case 3
               fgAppraise.Text = rs.Fields("attitude")
            Case 4
               fgAppraise.Text = rs.Fields("level")
            Case 5
               fgAppraise.Text = rs.Fields("appraiseDate")
            Case 6
               fgAppraise.Text = rs.Fields("appraiser")
        End Select
      Next j
    
        rs.MoveNext
        i = i + 1
    Wend

End If

rs.Close

End Sub

Private Sub Form_Load()
txtNo = ""

End Sub

Private Sub txtNo_GotFocus()
optQuery(1).Value = True

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -