ImportsSystem.Data.OleDbPublicClassParkingPrivateSubParking_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadNow_Timer.Enabled=TrueEndSubPrivateSubNow_Timer_Tick(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesNow_Timer.TickNow_Time_Label.Text=当前时间:&Date.NowEndSubPrivateSubEnter_Button_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesEnter_Button.Click'定义一个OLEDB连接字符串DimconStrAsString=Provider=Microsoft.Jet.OLEDB.4.0;DataSource=E:\test\test.mdb'实例化OLEDB连接DimconAsOleDbConnection=NewOleDbConnection(conStr)DimsqlAsNewSystem.Text.StringBuilder'定义数据库插入语句sql.Append(insertintoTime_billing([Car_Num],[Enter_Time]))sql.Append(values('&Trim(Car_Num_Text.Text)&','&Date.Now&'))'打开数据库链接con.Open()'定义执行命令DimcmdAsNewSystem.Data.OleDb.OleDbCommand(sql.ToString,con)'执行命令cmd.ExecuteNonQuery()'关闭数据库链接con.Close()MsgBox(提交成功!)EndSubPrivateSubLeave_Button_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesLeave_Button.ClickDimTime_LengthAsDoubleDimPack_FeeAsDoubleDimEnter_timeAsDateDimLeave_timeAsDateDimconStrAsString=Provider=Microsoft.Jet.OLEDB.4.0;DataSource=E:\test\test.mdbDimconAsOleDbConnection=NewOleDbConnection(conStr)DimselSqlAsNewSystem.Text.StringBuilderDiminSqlAsNewSystem.Text.StringBuilderDimupSqlAsNewSystem.Text.StringBuilderDimdelSqlAsNewSystem.Text.StringBuilderDimdrAsOleDbDataReadercon.Open()selSql.Append(select)selSql.Append(Enter_Time)selSql.Append(from[Time_billing])selSql.Append(whereCar_Num=').Append(Trim(Car_Num_Text.Text)).Append(')DimselcmdAsNewOleDb.OleDbCommand(selSql.ToString,con)dr=selcmd.ExecuteReader()Ifdr.Read()ThenEnter_time=dr(Enter_Time)Leave_time=Date.NowElseMsgBox(木有数据!)EndIfEnter_Time_Text.Text=Enter_timeLeave_Time_Text.Text=Leave_time'求时间差Time_Length=Math.Round(DateDiff(DateInterval.Minute,Enter_time,Leave_time)/60,2)Pack_Fee=Time_Length*5Pack_Fee_Text.Text=Pack_FeeinSql.Append(update[Time_billing])inSql.Append(set[Leave_Time]=').Append(Trim(Leave_Time_Text.Text)).Append(')inSql.Append(,[Packing_Fee]=').Append(Pack_Fee).Append(')inSql.Append(whereCar_Num=').Append(Trim(Car_Num_Text.Text)).Append(')DimincomAsNewOleDb.OleDbCommand(inSql.ToString,con)incom.ExecuteNonQuery()MsgBox(结算完成!)upSql.Append(insertintoTime_billing_History([Car_Num],[Enter_Time],[Leave_Time],[Packing_Fee]))upSql.Append(select)upSql.Append([Car_Num])upSql.Append(,[Enter_Time])upSql.Append(,[Leave_Time])upSql.Append(,[Packing_Fee])upSql.Append(from[Time_billing])upSql.Append(where[Car_Num]=').Append(Trim(Car_Num_Text.Text)).Append(')DimupcomAsNewOleDb.OleDbCommand(upSql.ToString,con)upcom.ExecuteNonQuery()delSql.Append(delete)delSql.Append(from)delSql.Append([Time_billing])delSql.Append(where[Car_Num]=').Append(Trim(Car_Num_Text.Text)).Append(')DimdelcomAsNewOleDb.OleDbCommand(delSql.ToString,con)delcom.ExecuteNonQuery()con.Close()EndSubPrivateSubClear_Button_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesClear_Button.ClickCar_Num_Text.Clear()Enter_Time_Text.Clear()Leave_Time_Text.Clear()Pack_Fee_Text.Clear()EndSubEndClass