版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
年4月19日用数据库设计影院售票管理系统文档仅供参考,不当之处,请联系改正。一.系统概述;1.设计需求;现在中国大部分的家庭都喜欢在家里置办属于自己风格的家庭影院。可是,依然有很多人喜欢到电影院去看电影。因为家里的气氛毕竟不如影院好。因此,现代家庭影院的出现并不会让电影院没有生路。每个社会服务系统都有自己的一套管理机制。当然,电影院也不除外。其实电影院的管理系统应该来说比其它的社会服务系统的管理要简单一点。电影院不外乎是引进电影,制定播放影片的时间表,买票,检票进场观看,还有就是一些数据管理方面的事。如工作人员管理,票务管理等等。为了工作机制简单有序,必然要引进一套管理系统。2.需求分析;具体而言,影院售票系统需要实现以下的需求:(1)能够对播放电影,工作人员,售票事宜,检票事宜,无用数据进行处理。(2)售票管理自然有专人负责,要处理各电影的电影票销售问题。当然包括退票问题,还有就是预订电影票其实也就相当于买票。两者能够当一回事处理。(3)检票管理事宜要完成观众进场时检票的事宜。其中包括了电影票的真假检测问题。(4)数据管理要处理电影的播放的次序,工作人员的管理,以及过期电影票的处理问题。电影电影号电影名称电影电影号电影名称主演导演生产地上映时间座位座位编号座位票价是否售出电影票电影票电影号电影名座位号价格电影票号上映时间映时间
验证码职工信息职工信息职工号职工类型职工密码三.设计说明1.分析与创立数据库;根据系统的功能分析结果,影院售票管理系统将会使用MicrosoftSQLSever作为后台的数据库管理系统。本管理系统是应用于电影院中,而且需要和数据库之间进行频繁数据交换,因此采用MicrosoftSQLSever作为后台的数据库管理系统。在本管理系统中,需要掌握影库充实信息,职工管理信息,票务管理信息,另外,由于要进行职工管理,还需要掌握使用本系统的职工。表1存储硬库信息列表,表2存储了电影院座位的相关数据连接关系,表3存储了电影票销售情况管理,表4存储了系统使用者职工的相关情况的管理列表。表1影库管理表MOVIES字段名称数据类型字段属性字段大小作用必填字段索引是否主键Movie_idsmallint2电影号是有(无重复)是Movie_nameNvarchar50电影名称是无actorNvarchar50导演否无actressNvarchar50主演否无producerNvarchar25制片厂否无palydatedatetime8上映时间是无表2电影院座位管理表SEATS字段名称数据类型字段属性字段大小作用必填字段索引是否主键seatidsmallint2座位号是有(无重复)是pricefloat8票价是无soldornotsmallint2是否售出是无表3电影票信息表TICKETS字段名称数据类型字段属性字段大小作用必填字段索引是否主键ticketsidsmallint2电影票号是有(无重复)是seatidsmallint2座位号是有Movie_idsmallint2电影号是有Movie_nameNvarchar50电影名否无palydatedatetime8上映时间是无pricefloat8价格是无yanzhengmasmallint2验证码是无是表4职工信息表WORKERS字段名称数据类型字段属性字段大小作用必填字段索引是否主键workeridsmallint2职工号是无是passwordsmallint2职工密码是无leibiesmallint2职工类型是无根据规范化的设计理念,本管理系统的数据分成上面4个表,减少了数据的冗余,同时在这些表之间又存在着一些关联关系。这四个表之间的这两种关系表现在下图所示的关系:2.创立登陆窗体模块;(1)窗体模块的功能登陆窗体(2)窗体界面的设计在工程中添加一个窗体,命名为“登陆系统”,用来作为系统登陆窗体。界面的设计如图3所示。(3)窗体代码ImportsSystem.Data.SqlClientPublicClassForm1InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用来对记录导航DimmyconAsNewSqlConnection'连接对象DimmycomAsNewSqlCommand'命令对象Dimmycom1AsNewSqlCommandDimfrm2AsNewForm2Dimfrm3AsNewForm3Dimfrm8AsNewForm8PrivateSubTimer1_Tick(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesTimer1.TickStatusBar1.Panels(0).Text=DateTime.TodayStatusBar1.Panels(1).Text=DateTime.Now.ToString("T")EndSubPrivateSubGroupBox1_Enter(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesGroupBox1.EnterIfRadioButton1.Checked=TrueThenRadioButton2.Checked=FalseRadioButton3.Checked=FalseElseIfRadioButton2.Checked=TrueThenRadioButton1.Checked=FalseRadioButton3.Checked=FalseElseIfRadioButton3.Checked=TrueThenRadioButton1.Checked=FalseRadioButton2.Checked=FalseEndIfEndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickAxShockwaveFlash1.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\登陆界面1.swf"AxShockwaveFlash1.Playing=FalseAxShockwaveFlash1.Stop()Dimtox1AsInt32Dimtox2AsInt32DimmydataadapterAsNewSqlDataAdapterDimmydsAsNewDataSetDimiAsIntegerDimjAsIntegertox1=Val(TextBox1.Text)tox2=Val(TextBox2.Text)mycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom.Connection=mycon'经过MYCON连接对象操作数据库mycom.CommandType=CommandType.Text'设置命令类型mycom.CommandText="select*fromworkers"'设置要执行的命令Trymycon.Open()mydataadapter.SelectCommand=mycomCatchexAsExceptionMessageBox.Show("连接失败")Finallymycon.Close()EndTrymydataadapter.Fill(myds,"workers")Fori=0Tomyds.Tables("workers").Rows.Count-1Iftox1=Val(myds.Tables("workers").Rows(i).ItemArray(0))Thenj=0ExitForElsej=1EndIfNextFori=0Tomyds.Tables("workers").Rows.Count-1Iftox2=Val(myds.Tables("workers").Rows(i).ItemArray(1))Thenj=0ExitForElsej=1EndIfNextIfj=1ThenMessageBox.Show("您的工号或者密码错误","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Warning)ElseTrymycom1.Connection=mycon'经过MYCON连接对象操作数据库mycom1.CommandType=CommandType.Text'设置命令类型mycom1.CommandText="selectleibiefromworkerswhereworkerid="+CStr(tox1)+"andpassword="+CStr(tox2)+""'设置要执行的命令Dimmydataadapter1AsNewSqlDataAdaptermydataadapter1.SelectCommand=mycom1Dimmyds1AsNewDataSetmydataadapter1.Fill(myds1,"workers")IfRadioButton1.Checked=TrueAndVal(myds1.Tables("workers").Rows(0)("leibie"))=1Thenfrm2.Show()Me.Hide()ElseIfRadioButton2.Checked=TrueAndVal(myds1.Tables("workers").Rows(0)("leibie"))=2Thenfrm3.Show()Me.Hide()ElseIfRadioButton3.Checked=TrueAndVal(myds1.Tables("workers").Rows(0)("leibie"))=3Thenfrm8.Show()Me.Hide()ElseMessageBox.Show("您超出职责范围或未选择服务系统,请重新输入!","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1)EndIfCatchexAsExceptionEndTryEndIfEndSubPrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlash1.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\登陆界面1.swf"AxShockwaveFlash1.Play()EndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass创立售票窗体模块窗体模块的功能为观众提供买票服务。在界面上观众能够看见座位的情况,根据此来选择自己喜欢的座位。不同的座位有不同的价格。此窗体还有退票功能。窗体界面的设计在工程中添加一个窗体,命名为“售票系统”,用来作为仓管人员窗体。界面的设计如下图所示。代码编写ImportsSystem.Data.SqlClientPublicClassForm2InheritsSystem.Windows.Forms.FormDimnavigatorAsBindingManagerBase'用来对记录导航DimmyconAsNewSqlConnection'连接对象DimmycomAsNewSqlCommand'命令对象PrivateSubForm2_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load'Me.Show()AxShockwaveFlash1.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\销售界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\检票界面下.swf"AxShockwaveFlash2.Play()DimmydataadapterAsNewSqlDataAdapterDimmydsAsNewDataSetDimiAsIntegerDimjAsIntegerDimstrrowAsStringDimdtAsNewDataTablemycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom.Connection=mycon'经过MYCON连接对象操作数据库mycom.CommandType=CommandType.Text'设置命令类型mycom.CommandText="select*fromMovies"'设置要执行的命令"Trymycon.Open()mydataadapter.SelectCommand=mycommydataadapter.Fill(myds,"Movies")CatchexAsExceptionMessageBox.Show("连接失败")Finallymycon.Close()EndTryTryFori=0Tomyds.Tables("Movies").Rows.Count-1strrow=myds.Tables("Movies").Rows(i)("movie_name")ComboBox1.Items.Add(strrow)NextCatchexAsExceptionMessageBox.Show(ex.ToString)EndTryEndSubPrivateSubButton1_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimiAsIntegerDimtickethaoAsIntegerDimmoviehaoAsIntegerDimsuijiAsIntegerDimmydataadapter3AsNewSqlDataAdapterDimmyds3AsNewDataSetDimdt3AsNewDataTableDimmycom3AsNewSqlCommandDimmycon3AsNewSqlConnectionRandomize()suiji=Int(9000*Rnd()+1000)Trytickethao=tickets_id()moviehao=movieid()mycon3.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom3.Connection=mycon3'经过MYCON连接对象操作数据库mycom3.CommandType=CommandType.Text'设置命令类型CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryIftickethao=0ThenTryMessageBox.Show("此座位已售出,请重新选择!","错误")ComboBox1.Text=""TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryElseTrymycon3.Open()mycom3.CommandText="insertintotickets(ticketsid,seatid,movie_id,movie_name,palydate,price,yanzhengma)values("+CStr(tickethao)+","+TextBox4.Text+","+CStr(moviehao)+",'"+TextBox2.Text+"','"+TextBox1.Text+"',"+TextBox5.Text+","+CStr(suiji)+")"DimsqlAsStringsql="insertintotickets(ticketsid,seatid,movie_id,movie_name,palydate,price,yanzhengma)values("+CStr(tickethao)+","+TextBox4.Text+","+CStr(moviehao)+",'"+TextBox2.Text+"','"+TextBox3.Text+"',"+TextBox5.Text+","+CStr(suiji)+")"mydataadapter3.InsertCommand=mycom3Trymycom3.ExecuteNonQuery()MessageBox.Show("售票成功!","谢谢观看")CatchexAsExceptionMsgBox(ex.ToString)EndTryCatchexAsExceptionMessageBox.Show(ex.ToString)EndTrymycon3.Close()ComboBox1.Text=""TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""EndIfrevoke_seat()EndSubPrivateSubComboBox1_SelectedIndexChanged_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesComboBox1.SelectedIndexChangedrevoke_seat()Dimmydataadapter1AsNewSqlDataAdapterDimmydataadapter11AsNewSqlDataAdapterDimmyds1AsNewDataSetDimmyds11AsNewDataSetDimdt1AsNewDataTableDimdt11AsNewDataTableDimmycom1AsNewSqlCommandDimmycom11AsNewSqlCommandmycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom1.Connection=mycon'经过MYCON连接对象操作数据库mycom1.CommandType=CommandType.Text'设置命令类型mycom11.Connection=myconmycom11.CommandType=CommandType.TextTrymycon.Open()mycom11.CommandText="selectpalydatefromMovieswheremovie_name='"+ComboBox1.Text+"'"mycom1.CommandText="select*fromticketswheremovie_name='"+ComboBox1.Text+"'"mydataadapter1.SelectCommand=mycom1mydataadapter11.SelectCommand=mycom11mydataadapter1.Fill(myds1,"tickets")mydataadapter11.Fill(myds11,"Movies")dt1=myds1.Tables("tickets")dt11=myds11.Tables("Movies")CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryTryIfdt1.Rows.Count=0ThenMessageBox.Show("还未出售!")TextBox1.Text=dt11.Rows(0)("palydate")revoke_seat()ElseShowSellInfo(dt1)TextBox1.Text=dt11.Rows(0)("palydate")EndIfCatchexAsExceptionEndTrymycon.Close()EndSubPrivateSubButton2_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimtickethaoAsIntegerDimmydataadapter4AsNewSqlDataAdapterDimmyds4AsNewDataSetDimdt4AsNewDataTableDimmycom4AsNewSqlCommandDimmycon4AsNewSqlConnectionTrymycon4.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom4.Connection=mycon4'经过MYCON连接对象操作数据库mycom4.CommandType=CommandType.Text'设置命令类型tickethao=tuipiao()CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryIftickethao=0ThenMessageBox.Show("座位号输入错误,请重新输入!","错误")ElseTrymycon4.Open()mycom4.CommandText="deletefromticketswhereticketsid="+CStr(tickethao)+""Trymycom4.ExecuteNonQuery()MessageBox.Show("退票成功!","谢谢观看")CatchexAsExceptionMsgBox(ex.ToString)EndTryCatchexAsExceptionMsgBox(ex.ToString)EndTryEndIfmycon4.Close()TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""ComboBox1.Text=""revoke_seat()EndSubPrivateSubButton3_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickTextBox2.Text=ComboBox1.TextTextBox3.Text=TextBox1.TextIfTextBox4.Text=""ThenMessageBox.Show("请输入座位号!","提示")EndIDimmydataadapter2AsNewSqlDataAdapterDimmyds2AsNewDataSetDimdt2AsNewDataTableDimmycom2AsNewSqlCommandmycon.ConnectionString="initialcatalog=ticketbooking;userid=sa;password=;"mycom2.Connection=mycon'经过MYCON连接对象操作数据库mycom2.CommandType=CommandType.Text'设置命令类型Trymycon.Open()mycom2.CommandText="select*fromseatswhereseatid="+TextBox4.Text+""mydataadapter2.SelectCommand=mycom2mydataadapter2.Fill(myds2,"seats")dt2=myds2.Tables("seats")CatchexAsExceptionMessageBox.Show(ex.ToString)EndTryTextBox5.Text=dt2.Rows(0)("price")mycon.Close()EndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass创立检票界面(1)创立模块的功能对进场观众检票,如果发现有假票或无票观众不允许入内。(2)创立模块的窗体在工程中添加一个窗体,命名为“检票系统”,用来作为检票系统窗体。界面的设计如下图所示。(3)代码编写ImportsSystem.Data.SqlClientPublicClassForm3InheritsSystem.Windows.Forms.FormDimds1AsNewDataSetDimsqlda1AsNewSqlDataAdapterDimRecordCountAsIntegerPrivateSubForm3_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlash1.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\检票界面.swf"AxShockwaveFlash1.Play()AxShockwaveFlash2.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\检票界面下.swf"AxShockwaveFlash2.Play()Dimsqlcmd1AsNewSqlCommandDimstr1AsString="select*fromtickets"sqlcmd1.Connection=sqlcn1sqlcmd1.CommandText=str1sqlda1.SelectCommand=sqlcmd1Trysqlcn1.Open()sqlcmd1.ExecuteNonQuery()CatchexAsSqlExceptionMsgBox(ex.Message)Finallysqlcn1.Close()EndTryTrysqlda1.Fill(ds1)CatchexAsSqlExceptionMsgBox(ex.Message)EndTryRecordCount=ds1.Tables(0).Rows.CountTextBox6.Text=RecordCountEndSubPrivateSubButton1_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimiAsIntegerDimflagAsBoolean=FalseIfTextBox1.Text=""ThenTextBox7.Text="请认真填写票号!"TextBox1.Focus()ExitSubEndIfIfTextBox2.Text=""ThenTextBox7.Text="请填写验证码!"TextBox2.Focus()ExitSubEndIfFori=0ToRecordCount-1IfTextBox1.Text=CStr(ds1.Tables(0).Rows(i)("ticketsid"))AndTextBox2.Text=CStr(ds1.Tables(0).Rows(i)("yanzhengma"))Thenflag=TrueExitForEndIfNextIfflag=TrueThenTryTextBox3.Text=ds1.Tables(0).Rows(i)("seatid")TextBox4.Text=ds1.Tables(0).Rows(i)("movie_name")TextBox5.Text=ds1.Tables(0).Rows(i)("price")CatchexAsExceptionMsgBox(ex.Message)EndTryTextBox7.Text="此票为真!"ElseTextBox7.Text="此票为假!"EndIfTextBox6.Text=RecordCountEndSubPrivateSubButton2_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickTextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""TextBox5.Text=""TextBox6.Text=""TextBox7.Text=""TextBox1.Focus()EndSubPrivateSubButton3_Click_1(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass创立维护界面(1)创立模块的功能给数据库维护工作人员选择维护的系统数据库(2)创立模块的设计在工程中添加一个窗体,命名为“维护系统”,用来作为维护系统窗体。界面的设计如下图所示。(3)代码编写PublicClassForm8InheritsSystem.Windows.Forms.FormPrivateSubForm8_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadAxShockwaveFlash1.Movie="E:\实验运行场\VB.NET程序设计\电影院票务系统\image\登陆界面.swf"AxShockwaveFlash1.Play()EndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimfrm4AsNewForm4frm4.Show()Me.Hide()EndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimfrm6AsNewForm6frm6.Show()Me.Hide()EndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickDimfrm9AsNewForm9frm9.Show()Me.Hide()EndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubEndClass1.创立影库界面(1)创立模块的功能对电影库播放列表的管理(2)创立模块的设计在工程中添加一个窗体,命名为“影库系统”,用来作为影库系统窗体。界面的设计如下图所示。(3)代码编写DimsqlAdapterAsNewSqlDataAdapterDimmovieRowAsDataRowDimRecordCountAsIntegerDimiAsInteger=0Dimidnum()AsIntegerDimCurrentPositionAsIntegerSubShowPosition()RecordCount=DataSet11.Movies.Rows.CountIfRecordCount=0ThenTextBox1.Text="无记录"ElseCurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)TextBox1.Text=movieRow.Item("movie_id")idnum(i)=TextBox1.Texti+=1TextBox2.Text=movieRow.Item("movie_name")TextBox3.Text=movieRow.Item("actor")TextBox4.Text=movieRow.Item("actress")TextBox5.Text=movieRow.Item("producer")TextBox6.Text=movieRow.Item("palydate")TextBox7.Text=CurrentPosition+1&"/"&RecordCountEndIfEndSubPrivateSubForm4_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDataSet11.Clear()Me.SqlDataAdapter1.Fill(DataSet11)ShowPosition()EndSubPrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickIfMe.BindingContext(DataSet11,"Movies").Position>0ThenMe.BindingContext(DataSet11,"Movies").Position-=1ShowPosition()ElseMessageBox.Show("已到达首记录!","提示信息")EndIfEndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickIfMe.BindingContext(DataSet11,"Movies").Position<RecordCount-1ThenMe.BindingContext(DataSet11,"Movies").Position+=1ShowPosition()ElseMessageBox.Show("已到达尾记录!","提示信息")EndIfEndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickMe.BindingContext(DataSet11,"Movies").Position=RecordCount-1ShowPosition()EndSubPrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.Click'添加数据DimjAsIntegerDimflagAsBoolean=TrueForj=0ToiIfTextBox1.Text=CStr(idnum(j))Thenflag=FalseMessageBox.Show("ID地址有冲突!","提示")EndIfNextIfflag=TrueThenDimMyNewDataAsDataRowMyNewData=DataSet11.Movies.NewRowTryWithMyNewData.BeginEdit()IfTextBox1.Text<>""Then.Item("movie_id")=TextBox1.TextElseMessageBox.Show("编号不能为空")ReturnEndIf.Item("movie_name")=TextBox2.Text.Item("actor")=TextBox3.Text.Item("actress")=TextBox4.Text.Item("producer")=TextBox5.Text.Item("palydate")=TextBox6.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)ReturnEndTryDataSet11.Movies.Rows.Add(MyNewData)TryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()MessageBox.Show(i&"条记录添加成功!")CatchexAsExceptionMessageBox.Show(ex.Message)EndTryidnum(i)=TextBox1.Texti=i+1EndIfEndSubPrivateSubButton6_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton6.Click'修改数据DimjAsIntegerForj=0ToiIfTextBox1.Text=CStr(idnum(j))ThenMessageBox.Show("ID地址有冲突!","提示")EndIfNextCurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)TryWithmovieRow.BeginEdit().Item("movie_id")=TextBox1.Text.Item("movie_name")=TextBox2.Text.Item("actor")=TextBox3.Text.Item("actress")=TextBox4.Text.Item("producer")=TextBox5.Text.Item("palydate")=TextBox6.Text.EndEdit()EndWithCatchexAsExceptionMessageBox.Show(ex.Message)ReturnEndTryTryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()MessageBox.Show(i&"条记录修改成功!")CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickMe.BindingContext(DataSet11,"Movies").Position=0ShowPosition()EndSubPrivateSubButton7_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton7.Click'删除数据CurrentPosition=Me.BindingContext(DataSet11,"Movies").PositionmovieRow=DataSet11.Movies.Rows(CurrentPosition)DimnAsInteger=movieRow.Item("movie_id")DimjAsInteger=0Forj=0ToiIfn=idnum(j)Thenidnum(j)=-1EndIfNextmovieRow.Delete()TryDimiAsInteger=SqlDataAdapter1.Update(DataSet11,"Movies")DataSet11.AcceptChanges()MessageBox.Show(i&"条记录删除成功!")CatchexAsExceptionMessageBox.Show(ex.Message)EndTryEndSubPrivateSubButton8_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton8.ClickDimexitformAsNewForm7Ifexitform.ShowDialog=DialogResult.OKThenexitform.Close()Me.Close()Application.Exit()EndIfEndSubPrivateSubButton9_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton9.Cl
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 重庆某机器人研发制造项目可行性研究报告
- 中心供氧、呼叫系统施工方案
- 人教版英语九年级全册教学计划
- 低值易耗管理制度
- 人教版→五年级英语下册课文翻译
- 基层工作的心得体会
- 节后复工复产工作方案
- 2026四川南充市高坪区劳动人事争议仲裁院招募就业见习人员2人模拟试卷附答案详解(综合卷)
- 2026年赣县区城区幼儿园园长公开竞聘模拟试卷【黄金题型】附答案详解
- 七年级下学期级部教师专业发展计划
- 2025四川泸州航发能源投资有限公司第二次社会招聘2人笔试历年参考题库附带答案详解
- OpenFOAM培训教学课件
- 预防安全事故踩踏课件
- 老人助浴协议书
- 2025广西崇左供电局项目资料员招聘25人(公共基础知识)综合能力测试题带答案解析
- 古建筑修复项目可行性研究报告
- 品牌可持续发展研究报告2025年
- 2025年中国银行信息科技岗笔试题及答案广西地区
- 北京中医药大学中医诊断学Z试题及答案
- 难治性癌痛的护理
- JG/T 160-2017混凝土用机械锚栓
评论
0/150
提交评论