公交查询系统的设计与实现

On Error GoTo ErrH

Dim rs As New ADODB.Recordset

rs.Open \站点\

rs.AddNew

rs.Fields(0).Value = Trim(Text1(0))

rs.Update rs.Close

Set rs = Nothing ShowMSH

Text1(0) = CInt(Text1(0)) + 1 MsgBox \添加成功!\ Exit Sub ErrH:

MsgBox Err.Description

End Sub

Private Sub UPTZD() On Error GoTo ErrH

Dim rs As New ADODB.Recordset

rs.Open \* from 站点 where 名称='\& Trim(MSH.TextMatrix(MSH.RowSel, 0)) & \ If rs.EOF = False Then

rs.Fields(0).Value = Trim(Text1(0))

rs.Update rs.Close

Set rs = Nothing ShowMSH

Command1(1).Enabled = False Command1(2).Enabled = False MsgBox \修改成功!\ Else

rs.Update rs.Close

Set rs = Nothing End If

Exit Sub ErrH:

MsgBox Err.Description

End Sub

Private Sub DELZD() On Error GoTo ErrH

Dim rs As New ADODB.Recordset

rs.Open \* from 站点 where 名称='\& Trim(MSH.TextMatrix(MSH.RowSel, 0)) & \ If rs.EOF = False Then rs.Delete rs.Update rs.Close

Set rs = Nothing ShowMSH

Command1(1).Enabled = False Command1(2).Enabled = False MsgBox \删除成功!\ Else

rs.Update rs.Close

Set rs = Nothing End If Exit Sub ErrH:

MsgBox Err.Description

End Sub

Private Sub MSH_Click()

If MSH.RowSel >= 1 Then

Text1(0) = MSH.TextMatrix(MSH.RowSel, 0)

Command1(1).Enabled = True Command1(2).Enabled = True End If End Sub

线路信息管理

Private Sub ShowMSH()

Dim rs As New ADODB.Recordset rs.Open \线路\

Set MSH.DataSource = rs

MSH.ColWidth(0) = 1100 MSH.ColWidth(1) = 2000 MSH.ColWidth(2) = 2000 MSH.ColWidth(3) = 1200 MSH.ColWidth(4) = 1200

rs.Close

Set rs = Nothing End Sub

Private Sub Command1_Click(Index As Integer) Select Case Index Case 0 ADDXL Case 1 UPTXL Case 2 DELXL

Case 4 Unload Me End Select End Sub

Private Sub Form_Load() ShowMSH

Dim rs As New ADODB.Recordset

rs.Open \站点\ If rs.EOF = False Then

rs.MoveFirst

Do While Not rs.EOF

Combo1.AddItem Trim(rs.Fields(0)) Combo2.AddItem Trim(rs.Fields(0)) rs.MoveNext Loop End If rs.Close

Set rs = Nothing End Sub

Private Sub ADDXL() On Error GoTo ErrH

Dim rs As New ADODB.Recordset

rs.Open \线路\

rs.AddNew

rs.Fields(0).Value = Trim(Text1(0)) rs.Fields(1).Value = Trim(Combo1) rs.Fields(2).Value = Trim(Combo2) rs.Fields(3).Value = Trim(Combo3) rs.Fields(4).Value = Trim(Combo4)

rs.Update rs.Close

Set rs = Nothing ShowMSH

MsgBox \添加成功!\ Exit Sub ErrH:

MsgBox Err.Description

End Sub

Private Sub UPTXL() On Error GoTo ErrH

Dim rs As New ADODB.Recordset

rs.Open \* from 线路 where 名称='\& Trim(MSH.TextMatrix(MSH.RowSel, 0))

联系客服:779662525#qq.com(#替换为@)