www.pudn.com > stu_rag.rar > QuerryS.frm, change:2003-04-04,size:3147b


VERSION 5.00 
Begin VB.Form frmQuerryS  
   BackColor       =   &H00FF8080& 
   BorderStyle     =   0  'None 
   Caption         =   "Form1" 
   ClientHeight    =   1245 
   ClientLeft      =   0 
   ClientTop       =   0 
   ClientWidth     =   6150 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   1245 
   ScaleWidth      =   6150 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  'CenterScreen 
   Begin VB.CommandButton CmdCancel  
      Caption         =   "取消" 
      Height          =   375 
      Left            =   4920 
      TabIndex        =   5 
      Top             =   720 
      Width           =   1095 
   End 
   Begin VB.CommandButton CmdOkay  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   4920 
      TabIndex        =   4 
      Top             =   240 
      Width           =   1095 
   End 
   Begin VB.Frame FrmMain  
      Height          =   975 
      Left            =   120 
      TabIndex        =   0 
      Top             =   120 
      Width           =   4575 
      Begin VB.TextBox txtValue  
         Height          =   285 
         Left            =   3000 
         TabIndex        =   3 
         Top             =   360 
         Width           =   1335 
      End 
      Begin VB.ComboBox CmbCompare  
         Height          =   315 
         Left            =   1680 
         Style           =   2  'Dropdown List 
         TabIndex        =   2 
         Top             =   360 
         Width           =   1215 
      End 
      Begin VB.ComboBox CmbFields  
         Height          =   315 
         Left            =   120 
         Style           =   2  'Dropdown List 
         TabIndex        =   1 
         Top             =   360 
         Width           =   1335 
      End 
   End 
End 
Attribute VB_Name = "frmQuerryS" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Public QuerryString As String 
Public dbrs As ADODB.Recordset 
Private Sub CmdCancel_Click() 
    Set dbrs = Nothing 
    QuerryString = "" 
    Unload Me 
End Sub 
 
Private Sub CmdOkay_Click() 
    If CmbFields.ListIndex = 0 Or CmbCompare.ListIndex = 0 Or txtValue.Text = "" Then 
        MsgBox "请输入完整信息", vbCritical, "提示" 
        Exit Sub 
    End If 
    If dbrs.Fields(CmbFields.ListIndex - 1).Type = adVarWChar Then 
        txtValue.Text = "'" & txtValue.Text & "'" 
    End If 
    QuerryString = CmbFields.Text & CmbCompare.Text & txtValue.Text 
    Set dbrs = Nothing 
    Me.Hide 
     
End Sub 
 
Private Sub Form_Load() 
    QuerryString = "" 
    Dim iCount As Integer 
    CmbFields.Clear 
    CmbFields.AddItem "请选择字段" 
    For iCount = 1 To dbrs.Fields.Count 
        CmbFields.AddItem dbrs.Fields(iCount - 1).Name 
    Next 
    CmbFields.ListIndex = 0 
    CmbCompare.Clear 
    CmbCompare.AddItem "请选择比较运算符" 
    CmbCompare.AddItem " = " 
    CmbCompare.AddItem " < " 
    CmbCompare.AddItem " > " 
    CmbCompare.AddItem " <> " 
    CmbCompare.AddItem " Like " 
    CmbCompare.ListIndex = 0 
     
End Sub