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

📄 frm_sql.frm

📁 VB做的管理系统 使用前先注册一下SmartMenuXP.dll
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmSql 
   BorderStyle     =   0  'None
   Caption         =   "查找"
   ClientHeight    =   2175
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   4545
   ControlBox      =   0   'False
   Icon            =   "Frm_Sql.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   2  'Custom
   ScaleHeight     =   2175
   ScaleWidth      =   4545
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton CmdSql 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      Height          =   315
      Index           =   1
      Left            =   3210
      TabIndex        =   2
      Top             =   1680
      Width           =   1035
   End
   Begin VB.CommandButton CmdSql 
      Caption         =   "确定(&Y)"
      Default         =   -1  'True
      Height          =   315
      Index           =   0
      Left            =   2085
      TabIndex        =   1
      Top             =   1680
      Width           =   1035
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00CFCFCF&
      Caption         =   "查找内容"
      ForeColor       =   &H00FF0000&
      Height          =   1035
      Left            =   150
      TabIndex        =   0
      Top             =   510
      Width           =   4215
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1687
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   420
         Width           =   735
      End
      Begin VB.ComboBox CboField 
         Height          =   300
         Left            =   180
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   420
         Width           =   1455
      End
      Begin VB.TextBox TxtSQL 
         Height          =   300
         Left            =   2475
         TabIndex        =   3
         Top             =   420
         Width           =   1350
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   300
         Left            =   3735
         TabIndex        =   6
         Top             =   405
         Width           =   330
         _ExtentX        =   582
         _ExtentY        =   529
         _Version        =   393216
         Enabled         =   0   'False
         Format          =   24772609
         CurrentDate     =   37644
      End
   End
   Begin VB.Image imgWindowBottomLeft 
      Height          =   450
      Left            =   1620
      Picture         =   "Frm_Sql.frx":33D2
      Top             =   2370
      Width           =   285
   End
   Begin VB.Image imgWindowBottomRight 
      Height          =   450
      Left            =   1980
      Picture         =   "Frm_Sql.frx":3B1C
      Top             =   2370
      Width           =   285
   End
   Begin VB.Label lblTitle 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "查  找"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   240
      Left            =   2970
      TabIndex        =   7
      Top             =   2550
      Width           =   540
   End
   Begin VB.Image imgTitleHelp 
      Height          =   210
      Left            =   2340
      Picture         =   "Frm_Sql.frx":4266
      Stretch         =   -1  'True
      Top             =   3090
      Width           =   210
   End
   Begin VB.Image imgTitleClose 
      Height          =   210
      Left            =   2385
      Picture         =   "Frm_Sql.frx":44B0
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   210
   End
   Begin VB.Image imgTitleMinimize 
      Height          =   210
      Left            =   2340
      Picture         =   "Frm_Sql.frx":46FA
      Stretch         =   -1  'True
      Top             =   2370
      Width           =   210
   End
   Begin VB.Image Imageicon 
      Height          =   315
      Left            =   3000
      Picture         =   "Frm_Sql.frx":4944
      Stretch         =   -1  'True
      Top             =   2910
      Width           =   315
   End
   Begin VB.Image imgTitleLeft 
      Height          =   450
      Left            =   900
      Picture         =   "Frm_Sql.frx":7D96
      Top             =   2370
      Width           =   285
   End
   Begin VB.Image imgTitleRight 
      Height          =   450
      Left            =   1260
      Picture         =   "Frm_Sql.frx":84E0
      Top             =   2370
      Width           =   285
   End
   Begin VB.Image imgWindowBottom 
      Height          =   450
      Left            =   1260
      Picture         =   "Frm_Sql.frx":8C2A
      Stretch         =   -1  'True
      Top             =   2850
      Width           =   285
   End
   Begin VB.Image imgWindowLeft 
      Height          =   450
      Left            =   1620
      Picture         =   "Frm_Sql.frx":9374
      Stretch         =   -1  'True
      Top             =   2850
      Width           =   285
   End
   Begin VB.Image imgWindowRight 
      Height          =   450
      Left            =   1980
      Picture         =   "Frm_Sql.frx":9ABE
      Stretch         =   -1  'True
      Top             =   2850
      Width           =   285
   End
   Begin VB.Image imgTitleMain 
      Height          =   450
      Left            =   900
      Picture         =   "Frm_Sql.frx":A208
      Stretch         =   -1  'True
      Top             =   2820
      Width           =   285
   End
End
Attribute VB_Name = "FrmSql"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public intNumField As Integer
Public strSqlField As String
Public sqlado As String
Dim a(30) As Integer

Private Sub CboField_Click()
  If a(CboField.ListIndex) <> 7 Then
      TxtSQL.Locked = False
      DTPicker1.Enabled = False
  Else
      TxtSQL.Locked = True
      DTPicker1.Enabled = True
      TxtSQL.Text = DTPicker1.Value
  End If
  Select Case a(CboField.ListIndex)
  Case 2, 3, 6, 7
    combo1.Clear
    combo1.AddItem "= ", 0
    combo1.AddItem "> ", 1
    combo1.AddItem ">= ", 2
    combo1.AddItem "< ", 3
    combo1.AddItem "<= ", 4
    combo1.AddItem "<> ", 5
    combo1.ListIndex = 0
  Case Else
    combo1.Clear
    combo1.AddItem "包含", 0
    combo1.AddItem "> ", 1
    combo1.AddItem ">= ", 2
    combo1.AddItem "< ", 3
    combo1.AddItem "<= ", 4
    combo1.AddItem "<> ", 5
    combo1.AddItem "= ", 6
    combo1.ListIndex = 0
  End Select
End Sub

Private Sub CmdSql_Click(Index As Integer)
    Select Case Index
    Case 0
        If Me.TxtSQL.Text = "" Then
            intNumField = -1
        Else
            If combo1.Text = "包含" Then
                 temp2 = "like "
                 temp3 = "*" & TxtSQL.Text & "*"
            Else
                 temp2 = combo1.Text
                 temp3 = TxtSQL.Text
            End If
            Select Case a(CboField.ListIndex)
                   Case 2
                      strSqlField = " " & temp2 & temp3
                   Case 7
                      strSqlField = " " & temp2 & "#" & temp3 & "#"
                   Case Else
                      strSqlField = " " & temp2 & "'" & temp3 & "'"
            End Select
            intNumField = CboField.ListIndex
        End If
    Case 1
        intNumField = -2
    End Select
    Unload Me
End Sub

Private Sub DTPicker1_Change()
    TxtSQL.Text = DTPicker1.Value
End Sub

Private Sub Form_Load()
On Error GoTo err_1
  MakeWindow Me
  
  Dim db As ADODB.Connection
  Dim adoPrimaryRS  As ADODB.Recordset
  Set db = New ADODB.Connection
  db.CursorLocation = adUseClient
  db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & fullpath("mdb\ziliao.lbl")

  Set adoPrimaryRS = New Recordset
  adoPrimaryRS.Open "select * from " & sqlado, db, adOpenStatic, adLockOptimistic
  Dim intTmp As Integer
  For intTmp = 0 To intNumField - 1
      Me.CboField.AddItem adoPrimaryRS.Fields(intTmp).Name
      a(intTmp) = adoPrimaryRS.Fields(intTmp).Type
  Next
  CboField.ListIndex = 0
  adoPrimaryRS.Close
  db.Close
  DTPicker1.Value = Date
Exit Sub
err_1:
  MsgBox Err.Description, vbCritical
End Sub

Private Sub imgTitleClose_Click()
    intNumField = -2
    Unload Me
End Sub

Private Sub imgTitleLeft_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub imgTitleMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub imgTitleMinimize_Click()
    Me.WindowState = 1
End Sub

Private Sub imgTitleRight_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

Private Sub lblTitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DoDrag Me
End Sub

⌨️ 快捷键说明

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