【正文】
還有要注意的一點(diǎn)是在顯示出了最近車站的線路后,為了返回開(kāi)始查詢到的線路,我用了 MSF1(i)做為存儲(chǔ) Dim intmin As Integer Dim intcount As Integer Dim alloks() As Integer Dim rs As Integer Dim oksn As Integer Dim strbij As String Dim bfin As Boolean intmin = 10000 If gcaf = 2 Then If = 查找經(jīng)過(guò)站點(diǎn)最小的線路 Then = 返回 oksn = 0 If MSF1(0).Visible = True Then ReDim alloks(MSF1(0).Rows) MSF1(1).Clear MSF1(1).Rows = MSF1(0).Rows For k = 0 To MSF1(0).Rows 1 intcount = 9999 bfin = False For t = 0 To NC + 2 If MSF1(0).TextMatrix(k, t) = Then Exit For End If MSF1(1).TextMatrix(k, t) = MSF1(0).TextMatrix(k, t) If bfin = False Then If = MSF1(0).TextMatrix(k, t) Or = MSF1(0).TextMatrix(k, t) Then If intcount = 9999 Then intcount = 0 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 Else intcount = intcount + 1 bfin = True End If Else If intcount 9999 Then intcount = intcount + 1 End If End If End If Next MSF1(1).TextMatrix(k, NC + 2) = MSF1(0).TextMatrix(k, NC + 2) alloks(oksn) = intcount oksn = oksn + 1 If intcount intmin Then intmin = intcount End If Next MSF1(0).Clear rs = 1 With MSF1(0) .TextMatrix(0, 1) = 車次 For k = 1 To NC + 1 .TextMatrix(0, k + 1) = 站 amp。以下代碼寫得不是很好 ,有點(diǎn)亂的感覺(jué) 39。把轉(zhuǎn)發(fā)站作為終點(diǎn)站進(jìn)行查詢 digeitemp = digein digein = 0 showSEdata , , 2 39。 39。 amp。該算法有一大好處是極大的提高了查詢的速度,因?yàn)?,在掃描整個(gè)數(shù)據(jù)庫(kù)時(shí),沒(méi)有內(nèi)循環(huán)。 其思路是先掃描整個(gè)數(shù)據(jù)庫(kù),把有起始站的車站名的記錄存放在 MSF1(1)中,把有終點(diǎn)站的車站名的記錄存放在 MSF1(2)中 39。第三次遞歸的時(shí)候,退出 a = MsgBox(沒(méi)有直達(dá)的車次 !您是否需要轉(zhuǎn)車 ?, vbInformation + vbOKCancel, 詢問(wèn) ) If a = vbOK Then = True = True MSF1(0).Visible = False End If Exit Sub End If showtitle (numb) Dim j As Integer Dim i As Integer Dim m As Integer Dim k As Integer Dim ball As Boolean Dim mrc As Set mrc = New Set mrc = With MSF1(numb) .Rows = 2 .Row = 1 Do While Not ball = False For m = 1 To NC If Text2(m).Text = Trim(s) Then ball = True Exit For End If Next If ball = True Then For k = m To NC If Text2(k).Text = Trim(e) Then Exit For End If Next End If If ball = True And k NC + 1 Then .Rows = .Rows + 1 For i = 1 To If (i 1) Null Then .TextMatrix(.Row, i 1) = (i 1) 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 End If Next i .Row = .Row + 1 End If Loop End With If numb = 0 Then MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False Else If numb = 2 Then MSF1(0).Visible = False MSF1(1).Visible = True MSF1(2).Visible = True End If End If If MSF1(0).Row = 1 And numb = 0 Then Call showSEdata(e, s, numb) End If If MSF1(1).Row = 1 And numb = 1 Then Call showSEdata(e, s, numb) End If If MSF1(2).Row = 1 And numb = 2 Then Call showSEdata(e, s, numb) End If Set mrc = Nothing End Sub Private Sub Cbe_Change() bcbm = False = = False = False showtitle 0 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False = False End Sub Private Sub Cbe_DropDown() bcbm = False = = False = False = False showtitle 0 MSF1(0).Visible = True MSF1(1).Visible = False MSF1(2).Visible = False End Sub Private Sub Cbm_DropDown() 39。該過(guò)程用到了遞歸主要是由于起始站和終點(diǎn)站可以互換 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 digein = digein + 1 39。用于顯示按起始站和終點(diǎn)站進(jìn)行的查詢 39。 CStr(k) .ColWidth(k) = 1000 Next .TextMatrix(0, NC + 2) = 備注 .ColWidth(0) = 200 .ColWidth(NC + 1) = 1000 .FixedRows = 1 For i = 1 To NC .ColAlignment(i) = 0 Next i .FillStyle = flexFillSingle .Col = 0 .Row = 0 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 .RowSel = 1 .ColSel = .Cols 1 .CellAlignment = 4 .Row = 1 End With Next End Sub Public Sub showdata(num As Integer) 39。用戶沒(méi)有選擇了更新數(shù)據(jù)庫(kù) 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 Dim strbs As String Dim intnb As Integer If Mid(, Len() 1, 1) \ Then Open + \ For Input As 1 Else Open + For Input As 1 End If Input 1, strbs intnb = CInt(Val(strbs)) For k = 0 To intnb 1 Input 1, strbs strbs Next Close 1 End If End Sub Public Sub showtitle(numt As Integer) 39。 這樣做的好處是可以大大提高效率,如果每次啟動(dòng)都要重新檢索數(shù)據(jù)庫(kù),則要花費(fèi)大量的時(shí)間 If IsBeginS = False Then 39。 并把這些車站名存放在一文本框中,以用于下次讀取 39。 以下代碼是用來(lái)把在數(shù)據(jù)庫(kù)的所有不同的車站顯示在起始站中 39。例如,可以打印一份將數(shù)據(jù)分組并計(jì)算數(shù)據(jù)總和的報(bào)表,也可以打印另一份帶有各種數(shù)據(jù)格式的打印郵件標(biāo)簽的報(bào)表。在打開(kāi)一個(gè)窗體時(shí), Microsoft Access 將從一個(gè)或多個(gè)表中檢 索數(shù)據(jù),并使用用戶在 “ 窗體向?qū)?” 選擇的版面布局或所創(chuàng)建的版面布局,將窗體顯示在屏幕上。查詢的同時(shí)也可以更新或刪除多條記錄,并對(duì)數(shù)據(jù)執(zhí)行內(nèi)嵌或自定義的計(jì)算。如果要從查詢、窗體或報(bào)表中的多個(gè)表中將數(shù)據(jù)合并在一起,就要定義各個(gè)表之間的關(guān)系。在這個(gè)文件中,用戶可以將自己的數(shù)據(jù)分別保存在各自獨(dú)立的存儲(chǔ)空間中,這些空間稱作表;可以使用聯(lián)機(jī)窗體來(lái)查看、添加及更新表中的數(shù)據(jù) ;使用查詢來(lái)查找并檢索所要的數(shù)據(jù);也可以使用報(bào)表以特定的版面布置來(lái)分析及打印數(shù)據(jù)。 結(jié)構(gòu)化查詢語(yǔ)言 SQL( Structured Query Language)是一種介于關(guān)系代數(shù)與關(guān)系演算之間的語(yǔ)言,其功能包括查詢、操縱、定義和控制四個(gè)方面,是一個(gè)通用的、功能極強(qiáng)的關(guān)系數(shù)據(jù)庫(kù)語(yǔ)言。在數(shù)據(jù)庫(kù)發(fā)展的歷史上,最重要的成就就是關(guān)系模型。 購(gòu)買設(shè)計(jì) : 382540551 全套包括 :開(kāi)題報(bào)告 ,論文 ,源程序 ,源代碼 ,答辯 PPT,萬(wàn)余套設(shè)計(jì) ,歡迎咨詢選購(gòu) ,價(jià)格最低質(zhì)量最好 二、 利用 adodc( ADO Data Control)進(jìn)行數(shù)據(jù)庫(kù)鏈 接: 使用 adodata 控件訪問(wèn)數(shù)據(jù)庫(kù)可以完全不用編寫代碼 ,只需要通過(guò)簡(jiǎn)單的設(shè)置和操作其屬性就可以實(shí)現(xiàn)與數(shù)據(jù)庫(kù)的連接 ,通過(guò)綁定數(shù)據(jù)感知控件 ,就能提供一個(gè)訪問(wèn)數(shù)據(jù)庫(kù)的界面 ,用來(lái)實(shí)現(xiàn)對(duì)數(shù)據(jù)庫(kù)的瀏覽 ,貼加 ,刪除 ,修改等操作 . 三、 利用 DAO 對(duì)數(shù)據(jù)庫(kù)進(jìn)行操縱 : 在 visual basic 中提供了兩種與 jet數(shù)據(jù)引擎接口的方法 :data控件與數(shù)據(jù)訪問(wèn)對(duì)象 (DAO)DAO 是