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

📄 自定义sql语句查询.frm

📁 软件用到的技巧:透明窗体
💻 FRM
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form Form11 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "自定义 SQL 语句查询"
   ClientHeight    =   3270
   ClientLeft      =   45
   ClientTop       =   480
   ClientWidth     =   8865
   LinkTopic       =   "Form11"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   3270
   ScaleWidth      =   8865
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00FFFFFF&
      Height          =   300
      Left            =   5085
      ScaleHeight     =   240
      ScaleWidth      =   3585
      TabIndex        =   6
      Top             =   195
      Width           =   3645
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "字段名称 - 字段类型 - 字段长度"
         Height          =   180
         Left            =   75
         TabIndex        =   7
         Top             =   45
         Width           =   2700
      End
   End
   Begin VB.ListBox List1 
      Height          =   2580
      Left            =   5085
      Sorted          =   -1  'True
      TabIndex        =   5
      Top             =   525
      Width           =   3645
   End
   Begin CSCommand.Command Command1 
      Height          =   375
      Left            =   3420
      TabIndex        =   4
      Top             =   2760
      Width           =   1560
      _ExtentX        =   2752
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "自定义SQL语句查询.frx":0000
      Caption         =   "开始查询 &S"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.TextBox Text1 
      Height          =   1650
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   3
      Top             =   945
      Width           =   4740
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      ItemData        =   "自定义SQL语句查询.frx":001C
      Left            =   2250
      List            =   "自定义SQL语句查询.frx":002C
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   195
      Width           =   2730
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "自定义 SQL 语句:"
      Height          =   240
      Left            =   240
      TabIndex        =   2
      Top             =   615
      Width           =   2040
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "选择需要查询的数据库:"
      Height          =   180
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   1980
   End
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/12/24
'描    述:商务名片及客户资料管理系统 Ver 1.73
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Option Explicit

Private Sub Combo1_Click()
'MsgBox "validate"
    Dim db     As Database
  Dim sc     As Recordset
  Set db = OpenDatabase(MdbPath)
'MsgBox Combo1.ListIndex
  Select Case Combo1.ListIndex
  Case 0
  Set sc = db.OpenRecordset("com")
    Case 1
    Set sc = db.OpenRecordset("ren")
    Case 2
    Set sc = db.OpenRecordset("baifang")
        Case 3
    Set sc = db.OpenRecordset("urls")
    End Select

  Dim i As Integer
  List1.Clear
  For i = 0 To sc.Fields.Count - 1
    List1.AddItem sc.Fields(i).Properties("name") & " - " & CType(sc.Fields(i).Properties("Type")) & " - " & sc.Fields(i).Properties("Size")
Next i
sc.Close
db.Close


End Sub

Private Sub Command1_Click()
    If Len(Trim(Text1.Text)) < 15 Then
        MsgBox "SQL 查询语句长度不够,无法传递此语句。", vbInformation
        Text1.SetFocus
        Exit Sub
    End If
    Text1.Text = Trim(Text1.Text)
    Select Case Combo1.ListIndex
        Case 0:
        allshow Text1.Text
        Case 1:
        ShowAllRen Text1.Text
        Case 2
        ShowAllBaiFang Text1.Text
        Case 3
        ShowAllUrls Text1.Text
    End Select
End Sub

Private Sub Form_Load()
Me.Icon = MDIForm1.Icon
Me.BackColor = FormBackColor
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 3
    Dim db     As Database
  Dim sc     As Recordset
  Set db = OpenDatabase(MdbPath)
  Combo1.ListIndex = 0
  Select Case Combo1.ListIndex
  Case 0
  Set sc = db.OpenRecordset("com")
    Case 1
    Set sc = db.OpenRecordset("ren")
    Case 2
    Set sc = db.OpenRecordset("baifang")
        Case 3
    Set sc = db.OpenRecordset("urls")
    End Select

  Dim i As Integer
  List1.Clear
  For i = 0 To sc.Fields.Count - 1
    List1.AddItem sc.Fields(i).Properties("name") & " - " & CType(sc.Fields(i).Properties("Type")) & " - " & sc.Fields(i).Properties("Size")
Next i
sc.Close
db.Close

End Sub
Private Function CType(i As Integer) As String
    If i = 10 Then
        CType = "Text(文本)"
    ElseIf i = 8 Then
        CType = "Date(日期)"
    ElseIf i = 12 Then
        CType = "Memo(备注)"
    ElseIf i = 4 Then
        CType = "Long(长整)"
    Else
        CType = "(未知类型)"
    End If
End Function

⌨️ 快捷键说明

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