国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

第一次機(jī)房收費(fèi)系統(tǒng)—上機(jī)

2019-11-11 04:26:39
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

前言:

       今天進(jìn)行上機(jī)部分的學(xué)習(xí),主要是宏觀邏輯的把控和對(duì)查詢語(yǔ)句的使用,首先我畫了個(gè)邏輯圖梳理思路,要做什么?先后順序?以及用到的知識(shí)點(diǎn)!

一、上機(jī)—輸入卡號(hào)

二、判斷卡號(hào)輸入是否規(guī)范

      1.是否輸入?2.是否為數(shù)字?(用代碼限制輸入)

三、判斷是否注冊(cè)

      查詢Student_info中的studentId

四、判斷卡內(nèi)是否有錢

      查詢Student_info中的cash(提示后要及時(shí)清空Text)

五、上機(jī)成功—更新數(shù)據(jù)表Online_info

      查詢正在上機(jī)的人數(shù)

六、代碼展示:

PRivate Sub cmdUp_Click()      Dim txtSQL As String   '查詢student_info,判斷卡號(hào)是否注冊(cè)      Dim txtSQL2 As String  '查詢online_info,判斷卡號(hào)是否正在上機(jī)      Dim txtSQL4 As String   '查詢basicdata_info中的limitcash      Dim txtSQL5 As String   '將該卡上機(jī)的信息填入到online_info表中      Dim txtSQL6 As String   '查詢正在上機(jī)的人數(shù)            Dim MsgText As String      Dim MsgText2 As String      Dim MsgText4 As String      Dim MsgText5 As String      Dim MsgText6 As String           Dim mrc As ADODB.Recordset      Dim mrc2 As ADODB.Recordset      Dim mrc4 As ADODB.Recordset      Dim mrc5 As ADODB.Recordset      Dim mrc6 As ADODB.Recordset            '判斷卡號(hào)是否為空      If Trim(txtCardID.Text) = "" Then          MsgBox "請(qǐng)輸入卡號(hào)!", vbOKOnly + vbExclamation, "提示"          txtCardID.SetFocus          Exit Sub      Else          If IsNumeric(txtCardID.Text) = False Then              MsgBox "卡號(hào)必須輸入數(shù)字!", vbOKOnly + vbExclamation, "提示"              txtCardID.Text = ""              txtCardID.SetFocus    ',清空輸入框,焦點(diǎn)返回到輸入框            Exit Sub          End If                    '查詢數(shù)據(jù)庫(kù)中基本信息表          txtSQL = "select * from student_Info where cardno= '" & Trim(txtCardID.Text) & "'"          Set mrc = ExecuteSQL(txtSQL, MsgText)                    '判斷該卡號(hào)是否注冊(cè)          If mrc.BOF And mrc.EOF Then              MsgBox "該卡號(hào)未注冊(cè),請(qǐng)先注冊(cè)!", vbOKOnly + vbExclamation, "提示"              txtCardID.Text = ""              txtCardID.SetFocus              Exit Sub          Else                '判斷卡號(hào)是否已經(jīng)退卡,退卡后不能上機(jī)               If Trim(mrc.Fields(10)) = "未激活" Then                  MsgBox "該卡已經(jīng)退卡", vbOKCancel + vbInformation, "提示"                  txtCardID.Text = ""                  txtCardID.SetFocus                  Exit Sub              Else               '查詢basicdata_info中的limitcash                  txtSQL4 = "select * from basicdata_info"                  Set mrc4 = ExecuteSQL(txtSQL4, MsgText4)                                        If Val(mrc.Fields(7)) < Val(mrc4.Fields(5)) Then                      MsgBox "余額不足,請(qǐng)充值后上機(jī)!", vbOKOnly + vbExclamation, "提示"                      txtCardID.Text = ""                      txtCardID.SetFocus                      Exit Sub                    Else                                        '判斷卡號(hào)是否正在上機(jī)                      txtSQL2 = "select * from online_info where cardno='" & Trim(txtCardID.Text) & "'"                      Set mrc2 = ExecuteSQL(txtSQL2, MsgText2)                                              '查詢student_info中的cash                      txtSQL = "select * from student_info where cardno='" & Trim(txtCardID.Text) & "'"                      Set mrc = ExecuteSQL(txtSQL, MsgText)                                            If mrc2.EOF = False Then                          MsgBox "該卡正在上機(jī)!"                          txtSID.Text = mrc2.Fields(2)                          txtName.Text = mrc2.Fields(3)                          txtSex.Text = mrc2.Fields(5)                          txtDepartment = mrc.Fields(4)                          txtType.Text = mrc2.Fields(1)                          txtUpdate.Text = mrc2.Fields(6)                          txtUptime.Text = mrc2.Fields(7)                          Exit Sub                                            Else                                            '顯示該卡號(hào)的一些基本信息                          txtSID.Text = mrc.Fields(1)                          txtName.Text = mrc.Fields(2)                          txtSex.Text = mrc.Fields(3)                          txtDepartment = mrc.Fields(4)                          txtType.Text = mrc.Fields(14)                          txtUpdate.Text = Date                          txtUptime.Text = Time                      End If                  '將上機(jī)前的余額提出來(lái),用于下機(jī)時(shí)計(jì)算余額                      txtRemain.Text = mrc.Fields(7)                                            '將該卡上機(jī)的信息填入到online_info表中                                            txtSQL5 = "select * from online_info"                      Set mrc5 = ExecuteSQL(txtSQL5, MsgText5)                                            mrc5.AddNew                      mrc5.Fields(0) = txtCardID.Text                      mrc5.Fields(1) = txtType.Text                      mrc5.Fields(2) = txtSID.Text                      mrc5.Fields(3) = txtName.Text                      mrc5.Fields(4) = txtDepartment.Text                      mrc5.Fields(5) = txtSex.Text                      mrc5.Fields(6) = Date                      mrc5.Fields(7) = Time                      mrc5.Fields(8) = Trim(Environ("computername"))                                            mrc5.Update                                            '查詢正在上機(jī)的人數(shù)                      txtSQL6 = "select * from online_info"                      Set mrc6 = ExecuteSQL(txtSQL6, MsgText6)                                            If mrc6.EOF = True Then                          lblnumber.Caption = 0                      Else                          lblnumber.Caption = mrc6.RecordCount                      End If                                    End If                                End If          End If      End If  End Sub  

小結(jié):其實(shí)上機(jī)這個(gè)點(diǎn)并不難,困難的是如何將各個(gè)表聯(lián)系起來(lái),在敲之前一定先做一個(gè)宏觀的把控,先做什么后做什么,這樣做起來(lái)也會(huì)很順暢!


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 大丰市| 皮山县| 泸定县| 磐石市| 威远县| 灵石县| 洱源县| 商河县| 清徐县| 翼城县| 漳浦县| 葫芦岛市| 和林格尔县| 临猗县| 湘阴县| 肥乡县| 从化市| 阳高县| 惠来县| 长兴县| 双流县| 乌恰县| 三门峡市| 江都市| 遂昌县| 桐城市| 佳木斯市| 象山县| 桑日县| 扬中市| 那曲县| 九江县| 广平县| 安顺市| 常州市| 义乌市| 饶阳县| 石阡县| 嘉祥县| 河间市| 封开县|