上機在機房系統是至關重要的,只要捋清思路,把大問題分解成乙個個的小問題再去解決,困惑就自然迎刃而解了。來看看我的思路吧!
**片段
private sub cmdonline_click()
dim txtsql as string
dim msgtext as string
dim mrc as adodb.recordset
dim mrc1 as adodb.recordset
dim mrc2 as adodb.recordset
dim mrc3 as adodb.recordset
dim mrc4 as adodb.recordset
'mrc連線學生表
txtsql = "select * from student_info where cardno='" & trim(txtcardno.text) & "'"
set mrc = executesql(txtsql, msgtext)
'mrc1連線online表
txtsql = "select * from online_info where cardno='" & trim(txtcardno.text) & "'"
set mrc1 = executesql(txtsql, msgtext)
'mrc2連線line表
txtsql = "select * from line_info where cardno='" & trim(txtcardno.text) & "'"
set mrc2 = executesql(txtsql, msgtext)
'mrc3連線basicdata表
txtsql = "select * from basicdata_info"
set mrc3 = executesql(txtsql, msgtext)
txtsql = "select * from online_info"
set mrc4 = executesql(txtsql, msgtext)
if trim(txtcardno.text) = "" then
msgbox "卡號不能為空!", 48, "警告"
txtcardno.setfocus
exit sub
end if
if not isnumeric(trim(txtcardno.text)) then
msgbox "請輸入數字!", 48, "警告"
txtcardno.text = ""
txtcardno.setfocus
exit sub
end if
if mrc.eof = true then
msgbox "此卡未註冊", 0 + 48, "系統提示"
txtcardno.setfocus
txtcardno.text = ""
exit sub
end if
if val(mrc.fields(7)) < val(mrc3.fields(5)) then
msgbox "餘額不足,請先充值!", 48, "警告"
txtcardno.setfocus
exit sub
end if
if mrc1.eof = true then
labsid.caption = mrc.fields(1)
labname.caption = mrc.fields(2)
lab***.caption = mrc.fields(3)
labdept.caption = mrc.fields(4)
labtype.caption = mrc.fields(14)
labondate.caption = date
labontime.caption = time
end if
if mrc1.eof = false then
msgbox "此卡正在上機,不能重複登入!", 48, "警告"
txtcardno.text = mrc.fields(0)
labsid.caption = mrc.fields(1)
labname.caption = mrc.fields(2)
lab***.caption = mrc.fields(3)
labdept.caption = mrc.fields(4)
labtype.caption = mrc.fields(14)
labondate.caption = mrc1.fields(6)
labontime.caption = mrc1.fields(7)
else
'更新online_info表
with mrc1
.addnew
.fields(0) = trim(txtcardno.text)
.fields(1) = trim(labtype.caption)
.fields(2) = trim(labsid.caption)
.fields(3) = trim(labname.caption)
.fields(4) = trim(labdept.caption)
.fields(5) = trim(lab***.caption)
.fields(6) = trim(labondate.caption)
.fields(7) = trim(labontime.caption)
.fields(8) = vba.environ("computername")
.fields(9) = now
.update
end with
'更新line_info表
with mrc2
.addnew
.fields(1) = txtcardno.text
.fields(2) = labsid.caption
.fields(3) = labname.caption
.fields(4) = labdept.caption
.fields(5) = trim(lab***.caption)
.fields(6) = labondate.caption
.fields(7) = labontime.caption
.fields(8) = null
.fields(9) = null
.fields(10) = null
.fields(11) = "0.0"
.fields(12) = mrc.fields(7)
.fields(13) = "正常上機"
.fields(14) = vba.environ("computername")
.update
end with
end if
label16.caption = "當前上機人數:" & mrc4.recordcount
laboffdate.caption = ""
labofftime.caption = ""
labctime.caption = ""
labbalance.caption = ""
labcmoney.caption = ""
end sub
顯示當前時間**
private sub timer1_timer()
end sub
在學習的計算機專案中,實踐類的比較有意思,要好好抓住機會多動腦多思考,加油! 機房收費系統 上機
檢查乙個卡號能否使用,需要檢查以下幾點 只有這幾點同時滿足,此卡才能正常上機。1 當然不用多說,不輸入卡號當然不能使用。2 與要求的最小餘額進行比較,小於最小餘額則禁止上機使用 3 此卡沒用註冊,登錄檔中沒有這條記錄 4 次卡正在處於上機狀態,提示正在上機,一卡禁止重複上機使用 下面的這段 僅為借鑑...
機房收費系統 上機
其實相比起下機,上機的功能相對簡單的多。我總結了一句話大概可以概括了上機的功能 讓賬戶裡錢夠的目前沒有上機的已經註冊過的使用者上機。關鍵點資料表 含義 賬戶裡的錢夠 student info 當使用者餘額高於最少錢數 目前沒有上機 online info online 表中不存在的使用者可上機 已經...
機房收費系統 上機
還在敲學生資訊管理系統的時候,就被師哥師姐告知機房有點兒難,尤其是什麼上下機,動態顯示金額還有強制下機部分。所以開始機房收費系統之後,我就先把上下機這幾部分跳過了,等把別的窗體敲完除錯好之後,發現上下機中,實際上上機還是比較簡單的,就是邏輯性相對於其他窗體來說強一點,但是如果我們把上機的流程畫到圖上...