📄 querrys.vb
字号:
Option Strict Off
Option Explicit On
Friend Class frmQuerryS
Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance Then
m_vb6FormDefInstance = Me
Else
Try
'对于启动窗体,所创建的第一个实例为默认实例。
If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
End Sub
'窗体重写处置,以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents CmdCancel As System.Windows.Forms.Button
Public WithEvents CmdOkay As System.Windows.Forms.Button
Public WithEvents txtValue As System.Windows.Forms.TextBox
Public WithEvents CmbCompare As System.Windows.Forms.ComboBox
Public WithEvents CmbFields As System.Windows.Forms.ComboBox
Public WithEvents FrmMain As System.Windows.Forms.GroupBox
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmQuerryS))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me.ToolTip1.Active = True
Me.CmdCancel = New System.Windows.Forms.Button
Me.CmdOkay = New System.Windows.Forms.Button
Me.FrmMain = New System.Windows.Forms.GroupBox
Me.txtValue = New System.Windows.Forms.TextBox
Me.CmbCompare = New System.Windows.Forms.ComboBox
Me.CmbFields = New System.Windows.Forms.ComboBox
Me.BackColor = System.Drawing.Color.FromARGB(128, 128, 255)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Text = "Form1"
Me.ClientSize = New System.Drawing.Size(410, 83)
Me.Location = New System.Drawing.Point(0, 0)
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ControlBox = True
Me.Enabled = True
Me.KeyPreview = False
Me.MaximizeBox = True
Me.MinimizeBox = True
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "frmQuerryS"
Me.CmdCancel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.CmdCancel.Text = "取消"
Me.CmdCancel.Size = New System.Drawing.Size(73, 25)
Me.CmdCancel.Location = New System.Drawing.Point(328, 48)
Me.CmdCancel.TabIndex = 5
Me.CmdCancel.BackColor = System.Drawing.SystemColors.Control
Me.CmdCancel.CausesValidation = True
Me.CmdCancel.Enabled = True
Me.CmdCancel.ForeColor = System.Drawing.SystemColors.ControlText
Me.CmdCancel.Cursor = System.Windows.Forms.Cursors.Default
Me.CmdCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmdCancel.TabStop = True
Me.CmdCancel.Name = "CmdCancel"
Me.CmdOkay.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.CmdOkay.Text = "确定"
Me.CmdOkay.Size = New System.Drawing.Size(73, 25)
Me.CmdOkay.Location = New System.Drawing.Point(328, 16)
Me.CmdOkay.TabIndex = 4
Me.CmdOkay.BackColor = System.Drawing.SystemColors.Control
Me.CmdOkay.CausesValidation = True
Me.CmdOkay.Enabled = True
Me.CmdOkay.ForeColor = System.Drawing.SystemColors.ControlText
Me.CmdOkay.Cursor = System.Windows.Forms.Cursors.Default
Me.CmdOkay.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmdOkay.TabStop = True
Me.CmdOkay.Name = "CmdOkay"
Me.FrmMain.Size = New System.Drawing.Size(305, 65)
Me.FrmMain.Location = New System.Drawing.Point(8, 8)
Me.FrmMain.TabIndex = 0
Me.FrmMain.BackColor = System.Drawing.SystemColors.Control
Me.FrmMain.Enabled = True
Me.FrmMain.ForeColor = System.Drawing.SystemColors.ControlText
Me.FrmMain.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.FrmMain.Visible = True
Me.FrmMain.Name = "FrmMain"
Me.txtValue.AutoSize = False
Me.txtValue.Size = New System.Drawing.Size(89, 19)
Me.txtValue.Location = New System.Drawing.Point(200, 24)
Me.txtValue.TabIndex = 3
Me.txtValue.AcceptsReturn = True
Me.txtValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
Me.txtValue.BackColor = System.Drawing.SystemColors.Window
Me.txtValue.CausesValidation = True
Me.txtValue.Enabled = True
Me.txtValue.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtValue.HideSelection = True
Me.txtValue.ReadOnly = False
Me.txtValue.Maxlength = 0
Me.txtValue.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtValue.MultiLine = False
Me.txtValue.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtValue.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.txtValue.TabStop = True
Me.txtValue.Visible = True
Me.txtValue.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.txtValue.Name = "txtValue"
Me.CmbCompare.Size = New System.Drawing.Size(81, 21)
Me.CmbCompare.Location = New System.Drawing.Point(112, 24)
Me.CmbCompare.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.CmbCompare.TabIndex = 2
Me.CmbCompare.BackColor = System.Drawing.SystemColors.Window
Me.CmbCompare.CausesValidation = True
Me.CmbCompare.Enabled = True
Me.CmbCompare.ForeColor = System.Drawing.SystemColors.WindowText
Me.CmbCompare.IntegralHeight = True
Me.CmbCompare.Cursor = System.Windows.Forms.Cursors.Default
Me.CmbCompare.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmbCompare.Sorted = False
Me.CmbCompare.TabStop = True
Me.CmbCompare.Visible = True
Me.CmbCompare.Name = "CmbCompare"
Me.CmbFields.Size = New System.Drawing.Size(89, 21)
Me.CmbFields.Location = New System.Drawing.Point(8, 24)
Me.CmbFields.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.CmbFields.TabIndex = 1
Me.CmbFields.BackColor = System.Drawing.SystemColors.Window
Me.CmbFields.CausesValidation = True
Me.CmbFields.Enabled = True
Me.CmbFields.ForeColor = System.Drawing.SystemColors.WindowText
Me.CmbFields.IntegralHeight = True
Me.CmbFields.Cursor = System.Windows.Forms.Cursors.Default
Me.CmbFields.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.CmbFields.Sorted = False
Me.CmbFields.TabStop = True
Me.CmbFields.Visible = True
Me.CmbFields.Name = "CmbFields"
Me.Controls.Add(CmdCancel)
Me.Controls.Add(CmdOkay)
Me.Controls.Add(FrmMain)
Me.FrmMain.Controls.Add(txtValue)
Me.FrmMain.Controls.Add(CmbCompare)
Me.FrmMain.Controls.Add(CmbFields)
End Sub
#End Region
#Region "升级支持"
Private Shared m_vb6FormDefInstance As frmQuerryS
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As frmQuerryS
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New frmQuerryS()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Public QuerryString As String
Public dbrs As ADODB.Recordset '进行窗体加载时向组合框中加入各选项
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCancel.Click
'UPGRADE_NOTE: 在对对象 dbrs 进行垃圾回收前,不可以销毁该对象。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"”
dbrs = Nothing
QuerryString = ""
Me.Close()
End Sub
Private Sub CmdOkay_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdOkay.Click
If CmbFields.SelectedIndex = 0 Or CmbCompare.SelectedIndex = 0 Or txtValue.Text = "" Then
MsgBox("请输入完整信息", MsgBoxStyle.Critical, "提示")
Exit Sub
End If
If dbrs.Fields(CmbFields.SelectedIndex - 1).Type = ADODB.DataTypeEnum.adVarWChar Then
txtValue.Text = "'" & txtValue.Text & "'"
End If
QuerryString = CmbFields.Text & CmbCompare.Text & txtValue.Text
'UPGRADE_NOTE: 在对对象 dbrs 进行垃圾回收前,不可以销毁该对象。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"”
dbrs = Nothing
Me.Hide()
End Sub
Private Sub frmQuerryS_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
QuerryString = ""
Dim iCount As Short
CmbFields.Items.Clear()
CmbFields.Items.Add("请选择字段")
For iCount = 1 To dbrs.Fields.Count '向组合框中加入各字段名
CmbFields.Items.Add(dbrs.Fields(iCount - 1).Name)
Next
CmbFields.SelectedIndex = 0
CmbCompare.Items.Clear()
CmbCompare.Items.Add("请选择比较运算符")
CmbCompare.Items.Add(" = ")
CmbCompare.Items.Add(" < ")
CmbCompare.Items.Add(" > ")
CmbCompare.Items.Add(" <> ")
CmbCompare.Items.Add(" Like ")
CmbCompare.SelectedIndex = 0
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -