基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)_第1頁(yè)
基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)_第2頁(yè)
基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)_第3頁(yè)
基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)_第4頁(yè)
基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)_第5頁(yè)
已閱讀5頁(yè),還剩63頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)(含詳細(xì)源程序)面向?qū)ο蟪绦蛟O(shè)計(jì)課程設(shè)計(jì)報(bào)告基于VB的影院售票管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)1一(系統(tǒng)概述31. 1項(xiàng)目需求31.2需求分析 3二(項(xiàng)目開(kāi)發(fā)計(jì)劃書(shū)4三(設(shè)計(jì)說(shuō)明書(shū)63.1分析與創(chuàng)建數(shù)據(jù)庫(kù)3. 2創(chuàng)建登陸窗體模塊83. 3創(chuàng)建售票窗體模塊153.4創(chuàng)建檢票界面283. 5創(chuàng)建維護(hù)界面333. 6創(chuàng)建影庫(kù)界面363.7創(chuàng)建職工界面453. 8創(chuàng)建票務(wù)界面54四(用戶操作手冊(cè)614.1系統(tǒng)概述614. 2使用方法61五(結(jié)語(yǔ)63六(參考文獻(xiàn)642一(系統(tǒng)概述1. 1項(xiàng)目需求現(xiàn)在中國(guó)大部分的家庭都喜歡在家里置辦屬于自己風(fēng)格的家庭影院。但是,仍 然有很多人喜歡到電

2、影院去看電影。因?yàn)榧依锏臍夥债吘共蝗缬霸汉?。所以,現(xiàn)代 家庭影院的出現(xiàn)并不會(huì)讓電影院沒(méi)有生路。每個(gè)社會(huì)服務(wù)系統(tǒng)都有自己的一套管理機(jī)制。當(dāng)然,電影院也不除外。其實(shí)電 影院的管理系統(tǒng)應(yīng)該來(lái)說(shuō)比其他的社會(huì)服務(wù)系統(tǒng)的管理要簡(jiǎn)單一點(diǎn)。電影院不外乎 是引進(jìn)電影,制定播放影片的時(shí)間表,買(mǎi)票,檢票進(jìn)場(chǎng)觀看,還有就是一些數(shù)據(jù)管 理方面的事。如工作人員管理,票務(wù)管理等等。為了工作機(jī)制簡(jiǎn)單有序,必然要引 進(jìn)一套管理系統(tǒng)。1.2 需求分析具體而言,影院售票系統(tǒng)需要實(shí)現(xiàn)以下的需求:(1)能夠?qū)Σシ烹娪埃ぷ魅?員,售票事宜,檢票事宜,無(wú)用數(shù)據(jù)進(jìn)行處理。(2)售票管理自然有專人負(fù)責(zé),要處理各電影的電影票銷售問(wèn)題。當(dāng)然包括

3、退 票問(wèn)題,還有就是預(yù)訂電影票其實(shí)也就相當(dāng)于買(mǎi)票。兩者可以當(dāng)一回事處理。(3)檢票管理事宜要完成觀眾進(jìn)場(chǎng)時(shí)檢票的事宜。其中包括了電影票的真假檢 測(cè)問(wèn)題。(4)數(shù)據(jù)管理要處理電影的播放的次序,工作人員的管理,以及過(guò)期電影票的 處理問(wèn)題。3二(項(xiàng)目開(kāi)發(fā)計(jì)劃書(shū)根據(jù)需求分析的結(jié)果,本小組成員討論協(xié)商,決定本系統(tǒng)主要?jiǎng)澐譃橐韵氯齻€(gè) 子模塊:售票管理模塊、檢票管理模塊、數(shù)據(jù)管理模塊。影院售票管理系統(tǒng)是一個(gè)基于電影院工作人員的系統(tǒng),不同類型的用戶在系統(tǒng) 中有不同的權(quán)限。主要有三種用戶:1(售票管理人員:主要負(fù)責(zé)賣(mài)票,訂票及退票事宜;2(檢票管理人員:主要 負(fù)責(zé)觀眾進(jìn)場(chǎng)時(shí)檢票工作,以及辨認(rèn)電影票的真假(此工作

4、自然可以由服務(wù)系統(tǒng)來(lái) 完成);3(數(shù)據(jù)處理人員:主要負(fù)責(zé)播放電影導(dǎo)入數(shù)據(jù)庫(kù),工作人員的應(yīng)聘以及開(kāi) 除的數(shù)據(jù)管理,還有過(guò)期電影票的數(shù)據(jù)處理;以下分別介紹此系統(tǒng)中各個(gè)系統(tǒng)(3 個(gè)子模塊。):(1)售票系統(tǒng)模塊給觀眾提供售票服務(wù)。不同的位置有不同的價(jià)格。要選購(gòu)哪個(gè)位置由觀眾決 定。工作人員根據(jù)觀眾的需要進(jìn)行操作。系統(tǒng)在購(gòu)票成功后會(huì)產(chǎn)生一個(gè)驗(yàn)證碼,此 驗(yàn)證碼連工作人員都不知道。是隨機(jī)生成的。用于對(duì)電影票真假的辯識(shí)。(2)檢票系統(tǒng)模塊在觀眾進(jìn)場(chǎng)時(shí)所使用的系統(tǒng)。由掃描儀掃描,取的驗(yàn)證碼,然后進(jìn)行辯識(shí),看 是不是和數(shù)據(jù)庫(kù)中數(shù)據(jù)一樣,如果一樣,則電影票為真,否則電影票為假。由此來(lái) 決定讓不讓觀眾入場(chǎng)。(3)維

5、護(hù)系統(tǒng)模塊此模塊是由電影院的數(shù)據(jù)庫(kù)管理員來(lái)管理的。他根據(jù)電影院事情的需要對(duì)有關(guān) 數(shù)據(jù)進(jìn)行處理。如電影票的管理,工作人員的管理,和電影庫(kù)的管理等。整個(gè)系統(tǒng)的結(jié)構(gòu)如下圖1所示:4影院售票管理系統(tǒng)xiop工作人員登錄維護(hù)系統(tǒng)檢票系統(tǒng)售票系統(tǒng)影工過(guò)片作期播人票放員務(wù)管管管理理理以下分別介紹系統(tǒng)中數(shù)據(jù)系統(tǒng)3個(gè)子模塊。(1)影片播放管理模塊影片播放管理是對(duì)電影院播放的電影的充實(shí),設(shè)定電影的播放,以及電影時(shí)間 的設(shè)定。當(dāng)所設(shè)定的電影已經(jīng)播放完成后,要對(duì)其進(jìn)行刪除。還要對(duì)數(shù)據(jù)庫(kù)進(jìn)行清 理,把一些沒(méi)用的數(shù)據(jù)全部清除。(2)工作人員管理:電影院里當(dāng)然有工作人員的增加與開(kāi)除,以及他們的管理權(quán)限的變化。這一部分事件的

6、發(fā)生都需要數(shù)據(jù)庫(kù)管理人員將有關(guān)數(shù)據(jù)進(jìn)行處理。保證數(shù)據(jù)庫(kù)里數(shù)據(jù)的統(tǒng)一與完整。其中有他們的共號(hào),登陸電影院管理系統(tǒng)的密碼,以及所擁有的權(quán)限。(3)過(guò)期票務(wù)管理:電影院里的電影在放過(guò)以后,在數(shù)據(jù)庫(kù)的電影票數(shù)據(jù)就會(huì)變成沒(méi)有用的數(shù)據(jù)。 通過(guò)此管理可以把那些沒(méi)用的過(guò)期的數(shù)據(jù)清除。這里指的是與放過(guò)的電影同名的電 影票清除,而其他的電影票保存不變。小組人員分工情況:王圣武登陸界面和售票界面、系統(tǒng)轉(zhuǎn)換界面的程序編寫(xiě),整個(gè)系統(tǒng)框架的設(shè)計(jì),整個(gè)系統(tǒng)界面及美化設(shè)計(jì),整個(gè)系統(tǒng)流程的管理,創(chuàng)建數(shù)據(jù)庫(kù)5張潤(rùn)馳檢票系統(tǒng)和整個(gè)維護(hù)系統(tǒng)的程序編寫(xiě),局部框架輔助設(shè)計(jì),創(chuàng)建數(shù)據(jù)庫(kù)本系統(tǒng)后臺(tái)數(shù)據(jù)庫(kù)采用目前比較流行的Microsoft

7、SQL Sever ,該數(shù)據(jù)庫(kù)系統(tǒng)在安全性、準(zhǔn)確性、運(yùn)行速度方面有絕對(duì)的優(yōu)勢(shì),并且處理數(shù)據(jù) 量大、效率高;前臺(tái)采用Microsoft公司的VB. NET 2003作為主要的開(kāi)發(fā)工具, 其可與SQL Sever 2000數(shù)據(jù)庫(kù)無(wú)縫銜接。三(設(shè)計(jì)說(shuō)明書(shū)1.3 分析與創(chuàng)建數(shù)據(jù)庫(kù)根據(jù)系統(tǒng)的功能分析結(jié)果,影院售票管理系統(tǒng)將會(huì)使用Microsoft SQL Sever 2000作為后臺(tái)的數(shù)據(jù)庫(kù)管理系統(tǒng)。本管理系統(tǒng)是應(yīng)用于電影院中,而且需要和數(shù)據(jù)庫(kù)之間進(jìn)行頻繁數(shù)據(jù)交換,所以采用Microsoft SQL Sever 2000作為后臺(tái)的數(shù)據(jù)庫(kù)管理系統(tǒng)。在本管理系統(tǒng)中,需要掌握影庫(kù)充實(shí)信息,職工管理信息,票務(wù)管

8、理信息,此外,由于要進(jìn)行職工管理,還需要掌握使用本系統(tǒng)的職工。表1存儲(chǔ)硬庫(kù)信息列表,表2存儲(chǔ)了電影院座位的相關(guān)數(shù)據(jù)連接關(guān)系,表3存儲(chǔ)了電影票銷售情況管理,表4存儲(chǔ)了系統(tǒng)使用者職工的相關(guān)情況的管理列表。表1影庫(kù)管理表-MOVIES字段屬性字段名數(shù)據(jù)類字段大作用 必填索引是否稱型小字段主鍵Movie_ismallin2電影號(hào)是有(無(wú)重復(fù))是d tMovie_nNvarcha50 電影名是 無(wú) ame r 稱actor Nvarcha50 導(dǎo)演 否 無(wú)6actress NvarchaoO 主演否無(wú) rproduceNvarcha25 制片J 否 無(wú) r rpalydatdatetim8上映時(shí)是無(wú)e

9、e間表2電影院座位管理表-SEATS字段屬性字段名數(shù)據(jù)類字段大作用必填索引是否主稱型小字段鍵seatid smallin2座位號(hào)是有(無(wú)重是t復(fù))price float 8票價(jià)是無(wú)soldorsmallin2是否售是無(wú)not t出 表3電影票信息表-TICKETS字段屬性字段名數(shù)據(jù)類字段大作用必填索引是否主稱型小字段鍵ticketssmallin2電影票是有(無(wú)重是id t號(hào) 復(fù))seatid smallin2座位號(hào) 是 有tMovie_ismallin2電影號(hào)是有d tMovie_nNvarcha50 電影名 否 無(wú) ame rpalydatdatetim8上映時(shí)是無(wú)7e e間price f

10、loat 8價(jià)格是無(wú)yanzhensmallin2驗(yàn)證碼是無(wú)是gma t表4職工信息表-WORKERS字段屬性字段名數(shù)據(jù)類字段大作用必填字索引是否主稱型小段鍵workersmallin2職工號(hào)是無(wú)是id tpasswosmallin2職工密是 無(wú)rd t碼leibie smallin2職工類是無(wú)t型根據(jù)規(guī)范化的設(shè)計(jì)理念,本管理系統(tǒng)的數(shù)據(jù)分成上面4個(gè)表,減少了數(shù)據(jù)的冗 余,同時(shí)在這些表之間乂存在著一些關(guān)聯(lián)關(guān)系。這四個(gè)表之間的這兩種關(guān)系表現(xiàn)在 下圖所示的關(guān)系:3.2創(chuàng)建登陸窗體模塊窗體模塊的功能登陸窗體(2)窗體界面的設(shè)計(jì)在工程中添加一個(gè)窗體,命名為“登陸系統(tǒng)”,川來(lái)作為系統(tǒng)登陸窗體。界面的設(shè)計(jì)如

11、圖3所示。窗體代碼Imports System. Data. SqlClient Public Class FormlInherits System. Windows. Forms. FormDim navigator As BindingManagerBase '用來(lái)對(duì)記錄導(dǎo)航Dim mycon As New SqlConnection '連接對(duì)象Dim my com As New SqlCommand '命令對(duì)象Dim mycoml As New SqlCommandDimfrm2AsNewForm2Dimfrm3AsNewForm3Dimfrm8AsNewForm

12、89Private Sub Timerl_Tick(ByVal sender As System. Object, ByVai e As System. EventArgs) Handles Timerl. TickStatusBarl. Panels(0). Text = DateTime. TodayStatusBarl. Panels (1). Text = DateTime. Now. ToString(,zT,z)End SubPrivate Sub GroupBoxlJnter (ByVai sender As System. Object, By Vai eAs System.

13、EventArgs) Handles GroupBoxl. EnterIf RadioButtonl. Checked = True ThenRadioButton2. Checked = FalseRadioButton3. Checked = FalseElself RadioButton2. Checked = True ThenRadioButtonl. Checked = FalseRadioButton3. Checked = FalseElself RadioButton3. Checked = True ThenRadioButtonl. Checked = FalseRadi

14、oButton2. Checked = FalseEnd IfEnd SubPrivate Sub Buttonl_Click(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles Buttonl. ClickAxShockwaveFlashl. Movie = "E: 實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET 程序10設(shè)計(jì)電影院票務(wù)系統(tǒng)image登陸界面1. swfAxShockwaveFlashl. Playing = FalseAxShockwaveF 1 ash 1. Stop()Dim toxl As In

15、t32Dim tox2 As Int32Dim mydataadapter As New SqlDataAdapterDim myds As New DataSetDim i As IntegerDim j As Integertoxl = Vai(TextBoxl. Text)tox2 = Vai(TextBox2. Text)mycon. ConnectionString = "initialcatalog=ticketbooking;user id=sa;password=:'mycom. Connection = mycon '通過(guò)MYCON連接對(duì)象操作數(shù)據(jù)庫(kù)

16、mycom. CommandType = CommandType. Text '設(shè)置命令類型mycom. CommandText = "select * from workers”'設(shè)置要執(zhí)行的命令Trymycon. Open()mydataadapter. SelectCommand = mycomCatch ex As Exception 11MessageBox. Show("連接失敗)Finallymycon. Close ()End Trymydataadapter. Fill(myds, “workers")For i = 0 To m

17、yds. Tables (,zworkersz,). Rows. Count - 1If toxl =Vai(myds. Tables("workers"). Rows(i). ItemArray (0) Then j 二 0Exit ForElseJ 二 1End IfNextFor i = 0 To myds. Tables (z,workerszz). Rows. Count - 1If tox2 =Vai(myds. Tables("workers"). Rows (i). ItemArray (1) Then J 二 0Exit ForElse

18、J 二 1End If12NextIf j = 1 ThenMessageBox. Show(您的工號(hào)或者密碼錯(cuò)誤,錯(cuò)誤提示”,MessageBoxButtons. OK, MessageBoxIcon. Warning)ElseTrymycoml. Connection = mycon '通過(guò)MYCON連接對(duì)象操作數(shù)據(jù)庫(kù)mycoml. CommandType = CommandType. Text '設(shè)置命令類型mycoml. CommandText = "select leibie fromworkers where workerid=/ + CStr (toxl

19、) + “and password= + CStr (tox2)+ '設(shè)置要執(zhí)行的命令Dim mydataadapterl As New SqlDataAdaptermydataadapterl. SelectCommand = mycomlDim mydsl As New DataSetmydataadapterl. Fill(mydsl, “workers")If RadioButtonl. Checked = True AndVal(mydsl. Tables("workers"). Rows(0)("leibie") = 1 T

20、henfrm2. Show()Me. HideOElself RadioButton2. Checked = True And 13Vai(mydsl. Tables("workers"). Rows(0)(leibie)= 2 Thenfrm3. Show()Me. HideOElself RadioButton3. Checked = True AndVal(mydsl. Tables("workers"). Rows(0)("leibie") = 3 Thenfrm8. Show()Me. HideOElseMessageBox

21、.Show(您超出職責(zé)范圍或未選擇服務(wù)系統(tǒng),請(qǐng)重新輸入,錯(cuò) 誤提示,MessageBoxButtons. 0K,MessageBoxIcon. Warning, MessageBoxDefaultButton. Buttonl)End IfCatch ex As ExceptionEnd TryEnd IfEnd SubPrivate Sub Forml_Load(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles MyBase. LoadAxShockwaveFlashl. Movie=E:實(shí)驗(yàn)運(yùn)行場(chǎng)VB.

22、 NET程序設(shè)計(jì)'電影院票務(wù)系 統(tǒng)image登陸界面1. swf"AxShockwaveFlashl. Play ()End Sub14Private Sub Button2_Click(ByVai sender As System. Object,ByVai e As System. EventArgs) Handles Button2. ClickDim exitform As New Form7If exitform. ShowDialog = DialogResult. OK Thenexitform. Close ()Me. Close ()Application.

23、 Exit ()End IfEnd SubEnd Class3. 3創(chuàng)建售票窗體模塊(1)窗體模塊的功能為觀眾提供買(mǎi)票服務(wù)。在界面上觀眾可以看見(jiàn)座位的情況,根據(jù)此來(lái)選擇自己喜歡的座位。不同的座位有不同的價(jià)格。此窗體還有退票功能。(2)窗體界面的設(shè)計(jì)在工程中添加一個(gè)窗體,命名為“售票系統(tǒng)”,用來(lái)作為倉(cāng)管人員窗體。界面 的設(shè)計(jì)如下圖所示。(3)代碼編寫(xiě)Imports System. Data. SqlClient Public Class Form2Inherits System. Windows. Forms. FormDim navigator As BindingManagerBase &#

24、39;用來(lái)對(duì)記錄導(dǎo)航15Dim mycon As New SqlConnection '連接對(duì)象Dim my com As New SqlCommand '命令對(duì)象Private Sub Form2_Load(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles MyBase. Load'Me. Show()AxShockwaveFlashl. Movie = E: 實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET程序設(shè)計(jì)'電影院票務(wù)系 統(tǒng)image'銷售界面.swfAxShockwaveF 1

25、 ash 1. Play ()AxShockwaveFlash2. Movie = E: 實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET程序設(shè)計(jì)'電影院票務(wù)系 統(tǒng)image'檢票界面下.swfAxShockwaveF 1 ash2. Play ()16Dim mydataadapter As New SqlDataAdapterDim myds As New DataSetDim i As IntegerDim j As IntegerDim strrow As StringDim dt As New DataTablemycon. ConnectionString = "initial

26、catalog=ticketbooking;user id=sa;password二;mycom. Connection = mycon '通過(guò) MYCON連接對(duì)象操作數(shù)據(jù)庫(kù)mycom. CommandType = CommandType. Text '設(shè)置命令類型mycom. CommandText = "select * from Movies,'設(shè)置要執(zhí)行的命令Trymycon. Open ()mydataadapter. SelectCommand = mycommydataadapter. Fill(myds, “Movies")Catch

27、 ex As ExceptionMessageBox. Show ("連接失敗”)Finallymycon. Close ()17End TryTryFor i = 0 To myds. Tables (,zMovies,z). Rows. Count - 1strrow =myds. Tables ("Movies") Rows (i) (movie_naine)ComboBoxl. Items. Add (strrow)NextCatch ex As ExceptionMessageBox. Show(ex. ToString)End TryEnd SubPr

28、ivate Sub Buttonl_Click_l(ByVai sender As System. Object, ByVai e As System. EventArgs) Handles Buttonl. ClickDim i As IntegerDim tickethao As IntegerDim moviehao As IntegerDim suiji As IntegerDim mydataadapter3 As New SqlDataAdapterDim myds3 As New DataSetDim dt3 As New DataTableDim mycom3 As New S

29、qlCommandDim mycon3 As New SqlConnection 18Randomize ()suiji = Int(9000 * Rnd() + 1000)Trytickethao = tickets_id()moviehao = movieid()mycon3. ConnectionString = "initialcatalog=ticketbooking;user id=sa;password=;mycom3. Connection = mycon3 '通過(guò)MYCON連接對(duì)象操作數(shù)據(jù)庫(kù)mycom3. CommandType = CommandType.

30、 Text '設(shè)置命令類型Catch ex As ExceptionMessageBox. Show(ex. ToString)End TryIf tickethao = 0 ThenTryMessageBox. Show (此座位已售出,請(qǐng)重新選擇,錯(cuò)誤)ComboBoxl. Text = TextBoxl. Text = TextBox2. Text =TextBox3. Text =19TextBox4. Text =TextBox5. Text =Catch ex As ExceptionMessageBox. Show(ex. ToString)End TryElseTrym

31、ycon3. Open ()mycom3. CommandText = insert into tickets(ticketsid, seatid, movie_id, movie_name, palydate, price, yanzhengma) values (“+ CStr(tickethao) + “+ TextBox4. Text + , + CStr(moviehao) + ,'” + TextBox2. Text + + TextBoxl. Text + ' J + TextBoxo. Text +" +CStr (sui ji) + )Dim sql

32、 As Stringsql = ,zinsert into tickets(ticketsid, seatid, movie_id, movie-name, palydate, price, yanzhengma) values ( + CStr(tickethao) + , + TextBox4. Text + + CStr(moviehao)+ + TextBox2. Text +" + TextBox3. Text + TextBoxo. Text +, + CStr (sui ji) + )mydataadapter3. InsertCommand = mycom3Trymy

33、com3. ExecuteNonQuery()20MessageBox. Show(售票成功,謝謝觀看)Catch ex As ExceptionMsgBox(ex. ToString)End TryCatch ex As ExceptionMessageBox. Show(ex. ToString)End Trymycon3. Close ()ComboBoxl. Text = TextBoxl. Text = TextBox2. Text =""TextBox3. Text =TextBox4. Text =TextBox5. Text =End Ifrevoke_se

34、at ()End SubPrivate Sub ComboBoxl_SelectedIndexChanged_l(ByVai sender AsSystem. Object, ByVai e As System. EventArgs) HandlesComboBoxl. SelectedlndexChangedrevoke_seat ()21Dim mydataadapterl As New SqlDataAdapterDim mydataadapterl1 As New SqlDataAdapterDim mydsl As New DataSetDim mydsll As New DataS

35、etDim dtl As New DataTableDim dtll As New DataTableDim mycoml As New SqlCommandDim mycoml1 As New SqlCommandmycon. ConnectionString = "initial catalog=ticketbooking;user id二sa;password二;mycoml. Connection = mycon '通過(guò) MYCON 連接對(duì)象操作數(shù)據(jù)庫(kù)mycoml. CommandType = CommandType. Text '設(shè)置命令類 型mycoml1

36、. Connection = myconmycoml1. CommandType = CommandType. TextTrymycon. Open()mycoml1. CommandText = "select palydate from Movies where movie_name= ' + ComboBoxl. Text + mycoml. CommandText = "select * from tickets where movie_name= ' + ComboBoxl. Text + 22 mydataadapterl. SelectComm

37、and = mycoml mydataadapterll. SelectCommand = mycoml1 mydataadapterl. Fill(mydsl, “tickets") mydataadapterll. Fill(myds11, “Movies") dtl = mydsl. Tables("tickets") dtll = mydsll. Tables("Movies") Catch ex As Exception MessageBox. Show(ex. ToString) End Try TryIf dtl. Ro

38、ws. Count = 0 ThenMessageBox. Show(“還未出售)TextBoxl. Text = dtll. Rows(0)("palydate")revoke_seat ()ElseShowSelllnfo(dtl)TextBoxl. Text = dtll. Rows(0)("palydate")End IfCatch ex As ExceptionEnd Trymycon. Close ()End Sub23Private Sub Button2_Click_l(ByVai sender As System. Object, By

39、Vai eAs System. EventArgs) Handles Button2. ClickDim tickethao As IntegerDim mydataadapter4 As New SqlDataAdapterDim myds4 As New DataSetDim dt4 As New DataTableDim mycom4 As New SqlCommandDim mycon4 As New SqlConnectionTrymycon4. ConnectionString = "initial catalog=ticketbooking;user id=sa;pas

40、sword=:' mycom4. Connection = mycon4 '通過(guò)MYCON連接對(duì)象操作數(shù)據(jù)庫(kù)mycom4. CommandType = CommandType. Text '設(shè)置命令類型tickethao = tuipiaoOCatch ex As ExceptionMessageBox. Show(ex. ToString)End TryIf tickethao = 0 ThenMessageBox. Show(座位號(hào)輸入錯(cuò)誤,請(qǐng)重新輸入”24錯(cuò)誤)ElseTrymycon4. Open()mycom4. CommandText = delete fr

41、om ticketswhere ticketsid= + CStr (tickethao) + Trymycom4. ExecuteNonQuery()MessageBox. Show(退票成功,謝謝觀看)Catch ex As ExceptionMsgBox (ex. ToString)End TryCatch ex As ExceptionMsgBox(ex. ToString)End TryEnd Ifmycon4. Close ()TextBoxl. Text = TextBox2. Text =""TextBox3. Text =""TextB

42、ox4. Text =25TextBoxo. Text =ComboBoxl. Text = revoke_seat ()End SubPrivate Sub Button3_Click_l(ByVai sender As System. Object, ByVai eAs System. EventArgs) Handles Button3. ClickTextBox2.Text = ComboBoxl. TextTextBox3.Text = TextBoxl. TextIf TextBox4. Text = "" ThenMessageBox. Show (請(qǐng)輸入座位

43、號(hào),提示)End IDim mydataadapter2 As New SqlDataAdapterDim myds2 As New DataSetDim dt2 As New DataTableDim mycom2 As New SqlCommandmycon. ConnectionString = "initial catalog=ticketbooking;user id=sa;password二;mycom2. Connection = mycon '通過(guò)MYCON連接對(duì)象操作數(shù)據(jù)庫(kù) mycom2. CommandType = CommandType. Text &#

44、39;設(shè)置命令類 型 Try 26mycon. Open()mycom2. CommandText = "select * from seats where seatid= + TextBox4. Text + mydataadapter2. SelectCommand = mycom2 mydataadapter2. Fill(myds2, “seats") dt2 = myds2. Tables("seats") Catch ex As Exception MessageBox. Show(ex. ToString) End TryTextBox5.

45、 Text = dt2. Rows(0)("price") mycon. Close () End SubPrivate Sub Button4_Click(ByVai sender As System. Object, ByVai e As System. EventArgs) Handles Button4. ClickDim exitform As New Form7If exitform. ShowDialog = DialogResult. OK Then exitform. Close ()Me. Close ()Application. Exit ()End

46、IfEnd SubEnd Class273. 4創(chuàng)建檢票界面(1)創(chuàng)建模塊的功能對(duì)進(jìn)場(chǎng)觀眾檢票,如果發(fā)現(xiàn)有假票或無(wú)票觀眾不允許入內(nèi)。(2)創(chuàng)建模塊的窗 體在工程中添加一個(gè)窗體,命名為“檢票系統(tǒng)”,用來(lái)作為檢票系統(tǒng)窗體。界面 的設(shè)計(jì)如下圖所示。(3)代碼編寫(xiě)Imports System. Data. SqlClient Public Class Form3Inherits System. Windows. Forms. FormDim dsl As New DataSetDim sqldal As New SqlDataAdapterDim RecordCount As Integer28Pri

47、vate Sub Form3_Load(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles MyBase. LoadAxShockwaveFlashl. Movie = E:實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET程序設(shè)計(jì)、電影院票務(wù)系 統(tǒng)image檢票界面.swfAxShockwaveF 1 ash 1. Play ()AxShockwaveFlash2. Movie = E: 實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET程序設(shè)計(jì)'電影院票務(wù)系統(tǒng)image檢票界面下.swfAxShockwaveF 1 ash2. Play ()Dim

48、 sqlcmdl As New SqlCommandDim strl As String = "select * from tickets”sqlcmdl. Connection = sqlcnl29sqlcmdl. CommandText = strlsqldal. SelectCommand = sqlcmdlTrysqlcnl. Open()sqlcmdl. ExecuteNonQuery ()Catch ex As SqlExceptionMsgBox(ex. Message)Finallysqlcnl. Close ()End TryTrysqldal.Fill(dsl)C

49、atch ex As SqlExceptionMsgBox(ex. Message)End TryRecordCount = dsl. Tables(0). Rows. CountTextBox6. Text = RecordCountEnd SubPrivate Sub Buttonl_Click_l(ByVai sender As System. Object, ByVai e As System. EventArgs) Handles Buttonl. ClickDim i As IntegerDim flag As Boolean = False 30If TextBoxl. Text

50、 = "" ThenTextBox7. Text = 請(qǐng)認(rèn)真填寫(xiě)票號(hào)TextBoxl. Focus ()Exit SubEnd IfIf TextBox2. Text = ThenTextBox7. Text = 請(qǐng)?zhí)顚?xiě)驗(yàn)證碼TextBox2. Focus ()Exit SubEnd IfFor i = 0 To RecordCount - 1If TextBoxl. Text = CStr (dsl. Tables (0). Rows (i) (,/ticketsid,/) AndTextBox2. Text =CStr(dsl. Tables(0). Rows(i)(&

51、quot;yanzhengma") Thenflag = TrueExit ForEnd IfNextIf flag = True ThenTryTextBox3.Text = dsl. Tables(0). Rows(i)(seatid)31TextBox4. Text = dsl. Tables (0). Rows (i) (z/movie_name/z)TextBox5. Text = dsl. Tables (0). Rows (i) (z/price,z)Catch ex As ExceptionMsgBox(ex. Message)End TryTextBox7. Tex

52、t ="此票為真ElseTextBox7. Text = 此票為假End IfTextBox6.Text = RecordCountEnd SubPrivate Sub Button2_Click_l(ByVai sender As System. Object, ByVai eAs System. Event/lrgs) Handles Button2. ClickTextBoxl. Text = TextBox2. Text =TextBox3. Text =TextBox4. Text =""TextBoxo. Text =TextBoxG. Text =T

53、extBox7. Text = 32TextBoxl. Focus ()End SubPrivate Sub Button3_Click_l(ByVai sender As System. Object,ByVai e As System. EventArgs) Handles Button3. ClickDim exitform As New Form7If exitform. ShowDialog = DialogResult. OK Then exitform. Close ()Me. Close ()Application. Exit ()End SubEnd Class3.5創(chuàng)建維護(hù)

54、界面創(chuàng)建模塊的功能給數(shù)據(jù)庫(kù)維護(hù)工作人員選擇維護(hù)的系統(tǒng)數(shù)據(jù)庫(kù)創(chuàng)建模塊的設(shè)計(jì)在工程中添加一個(gè)窗體,命名為“維護(hù)系統(tǒng)”,用來(lái)作為維護(hù)系統(tǒng)窗體。界面 的設(shè)計(jì)如下圖所示。33代碼編寫(xiě)Public Class Form8Inherits System. Windows. Forms. Form Private Sub Form8_Load(ByVaisender As System. Object, ByVai e As System. EventArgs) HandlesMyBase. LoadAxShockwaveFlashl. Movie = E:實(shí)驗(yàn)運(yùn)行場(chǎng)VB. NET程序設(shè)計(jì)、電影院票務(wù)系 統(tǒng)i

55、mage登陸界面.swf”AxShockwaveF 1 ash 1. Play ()End SubPrivate Sub Buttonl_Click(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles Buttonl. ClickDim frm4 As New Form4frm4. Show()Me. Hide()34End SubPrivate Sub Button2_Click(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Han

56、dles Button2. ClickDim frm6 As New Form6frm6. Show()Me. Hide()End SubPrivate Sub Button3_Click(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles Button3. ClickDim frm9 As New Form9frm9. Show()Me. HideOPrivate Sub Button4_Click(ByVai sender As System. Object, ByVai e AsSystem. EventArgs) Handles Button4. ClickDim exitform As New Form7If exitform. ShowD

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論