📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00FFC0C0&
Caption = "公交车查询系统"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
ForeColor = &H00FFC0C0&
LinkTopic = "Form1"
ScaleHeight = 10830
ScaleWidth = 15240
WindowState = 2 'Maximized
Begin VB.CommandButton clear
Caption = "清空内容"
Height = 495
Left = 6960
TabIndex = 17
Top = 6720
Width = 1455
End
Begin VB.Frame Frame2
BackColor = &H00C0FFC0&
BorderStyle = 0 'None
Caption = "显示结果"
Height = 2535
Left = 720
TabIndex = 13
Top = 3720
Width = 8535
Begin VB.Label Label7
BackColor = &H00C0FFC0&
Caption = "显示结果"
Height = 255
Left = 240
TabIndex = 18
Top = 120
Width = 1095
End
Begin VB.Label text2
BackColor = &H00FFFFFF&
ForeColor = &H000000FF&
Height = 1860
Left = 120
TabIndex = 14
Top = 600
Width = 8370
End
End
Begin VB.Frame Frame3
BackColor = &H00C0FFC0&
BorderStyle = 0 'None
Caption = "换乘查询"
Height = 1575
Left = 720
TabIndex = 4
Top = 1680
Width = 8535
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 3600
TabIndex = 9
Top = 840
Width = 1095
End
Begin VB.TextBox Text6
Height = 495
Left = 1680
TabIndex = 8
Top = 840
Width = 1695
End
Begin VB.TextBox Text5
Height = 495
Left = 1680
TabIndex = 7
Top = 240
Width = 1695
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "请输入终点站"
Height = 180
Left = 360
TabIndex = 6
Top = 960
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "请输入起始站"
Height = 180
Left = 360
TabIndex = 5
Top = 360
Width = 1080
End
End
Begin VB.Frame Frame1
BackColor = &H00C0FFC0&
BorderStyle = 0 'None
Caption = "查询站点"
Height = 1335
Left = 720
TabIndex = 0
Top = 240
Width = 8535
Begin VB.CommandButton Command3
Caption = "线路查询"
Height = 375
Left = 5640
TabIndex = 12
Top = 840
Width = 1095
End
Begin VB.TextBox Text3
Height = 495
Left = 2040
TabIndex = 11
Top = 720
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "站点查询"
Height = 375
Left = 5640
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
DataField = "busstation"
DataSource = "Adodc1"
Height = 495
Left = 2040
TabIndex = 2
Top = 120
Width = 1575
End
Begin VB.Label Label5
BackColor = &H00C0FFC0&
Caption = "格式如:(济南大学)"
Height = 375
Left = 3720
TabIndex = 16
Top = 240
Width = 1575
End
Begin VB.Label Label3
BackColor = &H00C0FFC0&
Caption = "格式如:2"
Height = 495
Left = 3720
TabIndex = 15
Top = 720
Width = 1695
End
Begin VB.Label Label6
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "请输入要查询的线路"
Height = 180
Left = 240
TabIndex = 10
Top = 720
Width = 1620
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "请输入要查询的站点"
Height = 180
Left = 240
TabIndex = 1
Top = 240
Width = 1620
End
End
Begin VB.Menu sysdata
Caption = "管理数据库(&A)"
End
Begin VB.Menu syshelp
Caption = "帮助(&H)"
Begin VB.Menu sysfunc
Caption = "系统功能"
End
Begin VB.Menu sysshow
Caption = "系统说明"
End
Begin VB.Menu call
Caption = "联系我"
End
End
Begin VB.Menu exit
Caption = "退出系统"
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub clear_Click()
Text1.Text = ""
text2.Caption = ""
Text3.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
End Sub
Private Sub call_Click()
call1.Show
End Sub
Private Sub Command1_Click()
text2.Caption = ""
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim param As ADODB.Parameter
If (Text5.Text = "" And Text6.Text = "") Then
MsgBox ("请输入要查询的内容!在点击查询")
Else
Set cn = New ADODB.Connection
cn.ConnectionString = "provider=msdasql.1;USER ID=sa;password=;initial catalog=bus;data source=data;"
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "p_qry3 "
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.LockType = adLockReadOnly
cmd.Prepared = True
Set param = cmd.CreateParameter("@start", adVarChar, adParamInput, 10, Trim(Text5.Text))
cmd.Parameters.Append param
Set param = cmd.CreateParameter("@stop", adVarChar, adParamInput, 10, Trim(Text6.Text))
cmd.Parameters.Append param
rs.Open cmd
cmd.Execute
If (rs.EOF) Then
MsgBox ("很抱歉没找到!")
Else
text2.Caption = "转车次数: " & rs!转车次数 & Space(3) & "乘车线路是:" & rs!乘车线路
End If
End If
Exit Sub
End Sub
Private Sub Command2_Click()
text2.Caption = " "
Dim str As String
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
If (Text1.Text = "") Then
MsgBox ("请输入要查询的内容!在点击查询按纽。")
Else
Set cn = New ADODB.Connection
cn.ConnectionString = "provider=msdasql.1;USER ID=sa;password=;initial catalog=bus;data source=data;"
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT distinct 线路 from table1 where" & " 站点='" & Text1.Text & "'"
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.Open cmd
cmd.Execute
If (rs.EOF) Then
MsgBox ("很抱歉没找到!")
Else
rs.MoveFirst
Do While Not rs.EOF
str = str & Trim(rs!线路) + Space(1)
rs.MoveNext
Loop
text2.Caption = str
End If
End If
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Command3_Click()
Dim str As String
text2.Caption = ""
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
If (Text3.Text = "") Then
MsgBox ("请输入要查询的内容!在点击查询")
Else
Set cn = New ADODB.Connection
cn.ConnectionString = "provider=msdasql.1;USER ID=sa;password=sa;initial catalog=bus;data source=data;"
cn.Open
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "SELECT distinct 站点,顺序 from table1 where" & " 线路='" & Text3.Text & "'" & "ORDER BY 顺序"
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.Open cmd
cmd.Execute
str = Text3.Text & " 路所经过的站点:"
If (rs.EOF) Then
MsgBox ("很抱歉没找到!")
Else
rs.MoveFirst
Do While Not rs.EOF
str = str + Trim(rs!站点) + Space(1)
rs.MoveNext
Loop
text2.Caption = str
End If
End If
End Sub
Private Sub Form_Load()
If frmLogin.Combo1.Text = "普通用户" Then sysdata.Visible = False
End Sub
Private Sub sysdata_Click()
Form2.Show
End Sub
Private Sub sysfunc_Click()
sysfunc1.Show
End Sub
Private Sub sysshow_Click()
sysshow1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -