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

📄 frm_sql.frm

📁 vb+mo而次开发实现鹰眼功能
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form frm_sql 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "SQL查询"
   ClientHeight    =   6240
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8055
   Icon            =   "frm_sql.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6240
   ScaleWidth      =   8055
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "查询结果:"
      Height          =   1095
      Left            =   0
      TabIndex        =   29
      Top             =   3480
      Width           =   2175
      Begin VB.OptionButton opt_atr 
         Caption         =   "属性表显示"
         Height          =   255
         Left            =   120
         TabIndex        =   31
         Top             =   720
         Width           =   1575
      End
      Begin VB.OptionButton opt_obj 
         Caption         =   "实体显示"
         Height          =   255
         Left            =   120
         TabIndex        =   30
         Top             =   360
         Value           =   -1  'True
         Width           =   1575
      End
   End
   Begin VB.TextBox txt_fld_div 
      Height          =   390
      Left            =   2400
      TabIndex        =   27
      Text            =   " "
      Top             =   1800
      Width           =   2295
   End
   Begin VB.CommandButton cmd_close 
      Caption         =   "关闭"
      Height          =   495
      Left            =   240
      TabIndex        =   25
      Top             =   5520
      Width           =   735
   End
   Begin VB.CommandButton cmd_clear 
      Caption         =   "清除"
      Height          =   495
      Left            =   1200
      TabIndex        =   24
      Top             =   5520
      Width           =   735
   End
   Begin VB.CommandButton cmd_qry 
      Caption         =   "查询"
      Height          =   495
      Left            =   720
      TabIndex        =   23
      Top             =   4800
      Width           =   735
   End
   Begin VB.ComboBox cbo_lyr 
      Height          =   300
      Left            =   240
      Style           =   2  'Dropdown List
      TabIndex        =   22
      Top             =   720
      Width           =   1815
   End
   Begin VB.ListBox lst_typ 
      Height          =   1860
      Left            =   6240
      TabIndex        =   19
      Top             =   960
      Width           =   1335
   End
   Begin VB.ListBox lst_fld 
      Height          =   1860
      Left            =   4920
      TabIndex        =   18
      Top             =   960
      Width           =   1335
   End
   Begin VB.TextBox txt_sql 
      BackColor       =   &H80000000&
      Enabled         =   0   'False
      Height          =   2055
      Left            =   2400
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   15
      Text            =   "frm_sql.frx":0442
      Top             =   3840
      Width           =   2535
   End
   Begin VB.TextBox txt_fld_ord 
      Height          =   375
      Left            =   2400
      ScrollBars      =   2  'Vertical
      TabIndex        =   14
      Text            =   " "
      Top             =   2760
      Width           =   2295
   End
   Begin VB.OptionButton opt_desc 
      Caption         =   "降序"
      Height          =   495
      Left            =   4080
      TabIndex        =   13
      Top             =   2280
      Width           =   855
   End
   Begin VB.OptionButton opt_asc 
      Caption         =   "升序"
      Height          =   255
      Left            =   3360
      TabIndex        =   12
      Top             =   2400
      Value           =   -1  'True
      Width           =   855
   End
   Begin VB.TextBox txt_factor 
      Height          =   1455
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   10
      Text            =   "frm_sql.frx":0444
      Top             =   1680
      Width           =   2175
   End
   Begin VB.TextBox txt_fld 
      Height          =   1095
      Left            =   2400
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   7
      Top             =   360
      Width           =   2295
   End
   Begin VB.Frame Frame1 
      Caption         =   "结果统计"
      Height          =   1815
      Left            =   5400
      TabIndex        =   1
      Top             =   3960
      Width           =   1935
      Begin VB.ComboBox cbo_add 
         Height          =   300
         ItemData        =   "frm_sql.frx":0446
         Left            =   120
         List            =   "frm_sql.frx":0448
         TabIndex        =   5
         Text            =   "聚合函数"
         Top             =   240
         Width           =   1695
      End
      Begin VB.ComboBox cbo_math 
         Height          =   300
         ItemData        =   "frm_sql.frx":044A
         Left            =   120
         List            =   "frm_sql.frx":044C
         TabIndex        =   4
         Text            =   "数学函数"
         Top             =   600
         Width           =   1695
      End
      Begin VB.ComboBox cbo_string 
         Height          =   300
         ItemData        =   "frm_sql.frx":044E
         Left            =   120
         List            =   "frm_sql.frx":0450
         TabIndex        =   3
         Text            =   "字符串函数"
         Top             =   960
         Width           =   1695
      End
      Begin VB.ComboBox cbo_date 
         Height          =   300
         ItemData        =   "frm_sql.frx":0452
         Left            =   120
         List            =   "frm_sql.frx":0454
         TabIndex        =   2
         Text            =   "日期时间函数"
         Top             =   1320
         Width           =   1695
      End
   End
   Begin VB.ComboBox cbo_cal 
      Height          =   300
      ItemData        =   "frm_sql.frx":0456
      Left            =   5520
      List            =   "frm_sql.frx":0458
      TabIndex        =   0
      Text            =   ">"
      Top             =   3480
      Width           =   1695
   End
   Begin VB.Label Label10 
      Caption         =   "查询语句:"
      Height          =   255
      Left            =   2520
      TabIndex        =   28
      Top             =   3360
      Width           =   2055
   End
   Begin VB.Label Label9 
      Caption         =   "分组字段:"
      Height          =   255
      Left            =   2400
      TabIndex        =   26
      Top             =   1560
      Width           =   1575
   End
   Begin VB.Label Label8 
      Caption         =   "字段类型:"
      Height          =   255
      Left            =   6480
      TabIndex        =   21
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label7 
      Caption         =   "字段名:"
      Height          =   255
      Left            =   5040
      TabIndex        =   20
      Top             =   600
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "字段信息:"
      Height          =   255
      Left            =   5760
      TabIndex        =   17
      Top             =   120
      Width           =   1215
   End
   Begin VB.Label Label5 
      Caption         =   "查询的地图:"
      Height          =   255
      Left            =   360
      TabIndex        =   16
      Top             =   240
      Width           =   1575
   End
   Begin VB.Label Label4 
      Caption         =   "排序字段:"
      Height          =   255
      Left            =   2400
      TabIndex        =   11
      Top             =   2400
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "查询条件:"
      Height          =   255
      Left            =   240
      TabIndex        =   9
      Top             =   1200
      Width           =   1695
   End
   Begin VB.Label Label2 
      Caption         =   "浏览字段:"
      Height          =   255
      Left            =   2520
      TabIndex        =   8
      Top             =   120
      Width           =   1815
   End
   Begin VB.Label Label1 
      Caption         =   "运算符号:"
      Height          =   255
      Left            =   5760
      TabIndex        =   6
      Top             =   3000
      Width           =   1215
   End
End
Attribute VB_Name = "frm_sql"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim str As String
Dim Str_fld As String
 
Sub Sql_create()
If opt_asc.Value = True Then
   
   If txt_fld_div.Text <> "" And txt_fld_ord.Text <> "" And txt_factor.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "group by" + " " + txt_fld_div.Text + " " + "order by" + " " + txt_fld_ord.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text <> "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "group by" + " " + txt_fld_div.Text + " " + "order by" + " " + txt_fld_ord.Text
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text = "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "order by" + " " + txt_fld_ord.Text
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text <> "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "group by" + " " + txt_fld_div.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text = "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "order by" + " " + txt_fld_ord.Text
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text = "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text <> "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "group by" + " " + txt_fld_div.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text = "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text
   End If
   

ElseIf opt_desc.Value = True Then

   If txt_fld_div.Text <> "" And txt_fld_ord.Text <> "" And txt_factor.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "group by" + " " + txt_fld_div.Text + " " + "order by" + " " + txt_fld_ord.Text + " " + "desc"
   ElseIf txt_factor.Text = "" And txt_fld_div.Text <> "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "group by" + " " + txt_fld_div.Text + " " + "order by" + " " + txt_fld_ord.Text + " " + "desc"
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text = "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "order by" + " " + txt_fld_ord.Text + " " + "desc"
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text <> "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text + " " + "group by" + " " + txt_fld_div.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text = "" And txt_fld_ord.Text <> "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "order by" + " " + txt_fld_ord.Text + " " + "desc"
   ElseIf txt_factor.Text <> "" And txt_fld_div.Text = "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "where" + " " + txt_factor.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text <> "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text + " " + "group by" + " " + txt_fld_div.Text
   ElseIf txt_factor.Text = "" And txt_fld_div.Text = "" And txt_fld_ord.Text = "" Then
      txt_sql.Text = "select" + " " + txt_fld.Text + " " + "from" + " " + cbo_lyr.Text
   End If

End If

End Sub







Private Sub cbo_add_Click()

If txt_fld.Text = "" Then
   txt_fld.Text = cbo_add.Text
Else
   txt_fld.Text = txt_fld.Text + "," + cbo_add.Text
End If

Sql_create

End Sub

Private Sub cbo_cal_Click()

If txt_factor.Text <> "" Then
  txt_factor.Text = txt_factor.Text + " " + cbo_cal.Text
End If

Sql_create

End Sub



Private Sub cbo_date_Click()

If txt_fld.Text = "" Then
   txt_fld.Text = cbo_date.Text
Else
   txt_fld.Text = txt_fld.Text + "," + cbo_date.Text
End If

Sql_create

End Sub

Private Sub cbo_lyr_Click()
Dim lyr As MapLayer
Dim fld As MapObjects2.Field
Dim flds As MapObjects2.Fields
Dim i As Integer
Dim shp As Object

Set lyr = New MapLayer
Set lyr = frm_main.Map1.Layers.Item(cbo_lyr.Text)

lst_fld.Clear
lst_typ.Clear

⌨️ 快捷键说明

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