- VERSION 5.00
- Begin VB.Form frmAirline2
- Caption = "航线信息查询"
- ClientHeight = 1548
- ClientLeft = 48
- ClientTop = 348
- ClientWidth = 3672
- LinkTopic = "Form1"
- ScaleHeight = 1548
- ScaleWidth = 3672
- StartUpPosition = 1 'CenterOwner
- Begin VB.ComboBox Combo1
- Height = 288
- Index = 1
- Left = 1200
- Style = 2 'Dropdown List
- TabIndex = 6
- Top = 480
- Width = 2172
- End
- Begin VB.TextBox txtNo
- Height = 270
- Left = 120
- TabIndex = 5
- TabStop = 0 'False
- Top = 1920
- Visible = 0 'False
- Width = 735
- End
- Begin VB.ComboBox Combo1
- Height = 288
- Index = 0
- Left = 1200
- Style = 2 'Dropdown List
- TabIndex = 2
- Top = 120
- Width = 2172
- End
- Begin VB.CommandButton cmdOk
- Caption = "确定 (&O)"
- Default = -1 'True
- Height = 375
- Left = 480
- TabIndex = 1
- Top = 1080
- Width = 1215
- End
- Begin VB.CommandButton cmdExit
- Caption = "取消 (&X)"
- Height = 375
- Left = 2040
- TabIndex = 0
- Top = 1080
- Width = 1215
- End
- Begin VB.Label lblitem
- Caption = "到达城市:"
- Height = 252
- Index = 1
- Left = 360
- TabIndex = 4
- Top = 480
- Width = 852
- End
- Begin VB.Label lblitem
- Caption = "出发城市:"
- Height = 252
- Index = 0
- Left = 360
- TabIndex = 3
- Top = 120
- Width = 852
- End
- End
- Attribute VB_Name = "frmAirline2"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdExit_Click()
- Me.Hide
- End Sub
- Private Sub cmdOK_Click()
- Dim sQSql As String
- If (Trim(Combo1(0)) = "") Or (Trim(Combo1(1)) = "") Then
- MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- Else
- sQSql = "select * from airlineInfo where departCity = '" & Trim(Combo1(0)) & "' and arrivalCity = '" & Trim(Combo1(1)) & "'"
- End If
- Unload frmAirline
- frmAirline.txtSQL = sQSql
- frmAirline.Show
- End Sub
- Private Sub Form_Load()
- Dim i As Integer
- Dim sSql As String
- Dim txtSQL As String
- Dim MsgText As String
- Dim mrc As ADODB.Recordset
- For i = 0 To 1
- Combo1(i).Clear
- Next i
- txtSQL = "select DISTINCT departCity from airlineInfo"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- Combo1(0).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- Else
- MsgBox "请先进行航线信息设置!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- End If
- mrc.Close
- txtSQL = "select DISTINCT arrivalCity from airlineInfo"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- Combo1(1).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- Else
- MsgBox "请先进行航线信息设置!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- End If
- mrc.Close
- End Sub
- Private Sub txtItem_GotFocus(Index As Integer)
- txtItem(Index).SelStart = 0
- txtItem(Index).SelLength = Len(txtItem(Index))
- End Sub