【正文】
警告 End IfEnd IfDim strsql As StringDim strsql1 As Stringstrsql = select 宿舍號(hào) as [sushe] from 宿舍 Dim conn As New Dim rst As New Dim cmd As New = strcon 39。引用公共變量 = conn = strsqlSet rst = Do Until If UCase(struser) = UCase(rst(sushe)) Then strsql1 = select ,姓名,班級(jí),違紀(jì)處理情況,備注 from 宿舍,學(xué)生,宿舍信息 where = and = and =39。 amp。 amp。 39。 Call bindGrid(strsql1) Exit Sub Else strsql1 = select ,姓名,班級(jí),違紀(jì)處理情況,備注 from 宿舍,學(xué)生,宿舍信息 where = and = and =39。 amp。 amp。 39。 Call bindGrid(strsql1)End If Loop End SubSub bindGrid(strsql As String)Rem 綁定datagrid Dim conn As New Dim rst As New = strcon 39。引用公共變量 = adUseClient strsql, conn, adOpenDynamic, adLockBatchOptimistic Set = Call gridWidth blnAdding1 = True End SubPrivate Sub Command4_Click() If Trim() = Then MsgBox 沒(méi)有選中任何行或則[學(xué)號(hào)]為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String Dim strsql1 As String strsql = update 學(xué)生 set 學(xué)號(hào)=39。 amp。 amp。 39。,姓名=39。 amp。 amp。 39。,班級(jí)=39。 amp。 amp。 39。 where 學(xué)號(hào)=39。 amp。 amp。 39。 strsql1 = update 宿舍 set 宿舍號(hào)=39。 amp。 amp。 39。,備注=39。 amp。 amp。 39。 where 宿舍號(hào)=39。 amp。 amp。 39。 Call sqlcmd(strsql) Call sqlcmd(strsql1) blnAdding = False strsql1 = select ,姓名,班級(jí),違紀(jì)處理情況,備注 from 宿舍,學(xué)生,宿舍信息 where = and = and =39。 amp。 amp。 39。 Call bindGrid(strsql1) MsgBox 執(zhí)行成功!, vbInformation, 提示 = = = = = Exit SubmyError: MsgBox 更新失?。?amp。 Chr(10) + Chr(13) amp。 更新的數(shù)據(jù)中存在非法字符[空格、單引號(hào)、雙引號(hào)、空], vbExclamation, 提示End SubPrivate Sub Command5_Click()If Trim() = Then MsgBox 沒(méi)有選中任何行或則[學(xué)號(hào)]為空!, vbInformation, 提示 Exit Sub End If If MsgBox(確定刪除學(xué)號(hào)為[ amp。 amp。 ]的記錄?, vbOKCancel, 提示) = vbCancel Then Exit Sub End If If blnAdding = True Then = = = = = = True = True End If On Error GoTo myError: Dim strsql As String strsql = delete from 宿舍信息 where 宿舍號(hào)=39。 amp。 amp。 39。 Call sqlcmd(strsql) strsql = delete from 學(xué)生 where 學(xué)號(hào)=39。 amp。 amp。 39。 Call sqlcmd(strsql) strsql = delete from 宿舍 where 宿舍號(hào)=39。 amp。 amp。 39。 Call sqlcmd(strsql) blnAdding = False MsgBox 執(zhí)行成功!, vbInformation, 提示 = = = = = Exit SubmyError: MsgBox 刪除失敗請(qǐng)重試! amp。 Chr(34) + Chr(10) amp。 可能原因:與數(shù)據(jù)庫(kù)連接時(shí)失敗, vbExclamation, 提示End SubPrivate Sub Command6_Click()Unload MeEnd SubPrivate Sub DataGrid1_Click()blnAdding = False = True = True Dim n As Integer Dim DgCount As Integer DgCount = If blnAdding1 = True ThenFor n = 0 To DgCount 1 = n Select Case n Case 0 = Case 1 = Case 2 = Case 3 = Case 5 = End Select Next nElse Exit SubEnd IfEnd SubPrivate Sub cmdUpdate_Click()End SubPrivate Sub Form_Load()strcon = Provider=。Integrated Security=SSPI。Persist Security Info=False。Initial Catalog=學(xué)生宿舍管理系統(tǒng)。server=(local)blnAdding1 = FalseEnd SubSub gridWidth() Dim n As Integer Dim DgCount As Integer DgCount = For n = 0 To DgCount 1 (n).Width = Len((n).Caption) * 350 = n = False = False = False = False Next nEnd SubPrivate Sub DridStudent_RowColChange(LastRow As Variant, ByVal LastCol As Integer) End SubSub sqlcmd(strsql As String) 39。更新、刪除、插入數(shù)據(jù) Dim conn As New Dim cmd As New = strcon 39。引用公共變量 = conn = strsql End Sub 5 系統(tǒng)測(cè)試系統(tǒng)測(cè)試的目標(biāo)為了發(fā)現(xiàn)程序系統(tǒng)可能存在的錯(cuò)誤。測(cè)試的原則是:盡量不由程序設(shè)計(jì)者進(jìn)行測(cè)試;要注重測(cè)試用例的選擇;充分注意測(cè)試中的群集現(xiàn)象。本軟件在操作過(guò)程中,操作方便、簡(jiǎn)單容易入手,各個(gè)控件功能的實(shí)現(xiàn)都是如我所設(shè)計(jì)一樣。 應(yīng)用程序設(shè)計(jì)完成后,最后的工作就是編譯成可執(zhí)行文件,并且制作一個(gè)可在其他客戶端機(jī)器上安裝的程序。通過(guò)Visual Basic ,注意附帶文件的安裝路徑。設(shè)置基本信息,特性設(shè)置,安裝類型,升級(jí)路徑,添加指定的程序內(nèi)容,設(shè)置目標(biāo)系統(tǒng),定制安裝對(duì)話框,定義安裝系統(tǒng)要求和操作,最后發(fā)布安裝。總 結(jié)通過(guò)這次實(shí)驗(yàn),我拓寬了知識(shí)面,鍛煉了能力,同時(shí)使個(gè)人的綜合素質(zhì)得到較大提高。 安排實(shí)驗(yàn)的基本目的在于通過(guò)理論與實(shí)際的結(jié)合、人與人的溝通,進(jìn)一步提高思想覺(jué)悟。尤其是觀察、分析和解決問(wèn)題的實(shí)際工作能力。 作為整個(gè)學(xué)習(xí)體系的有機(jī)組成部分,實(shí)驗(yàn)課程雖然安排的課時(shí)比較少,但不是否定它的重要性。它的一個(gè)重要功能,在于運(yùn)用學(xué)習(xí)成果,檢驗(yàn)學(xué)習(xí)成果。運(yùn)用學(xué)習(xí)成果,把課堂上學(xué)到的系統(tǒng)化的理論知識(shí),嘗試性地應(yīng)用于實(shí)際設(shè)計(jì)工作,并從理論的高度對(duì)設(shè)計(jì)工作的現(xiàn)代化提出一些有針對(duì)性的建議和設(shè)想。檢驗(yàn)學(xué)習(xí)成果,看一看課堂學(xué)習(xí)與實(shí)際工作到底有多大距離,并通過(guò)綜合分析,找出學(xué)習(xí)中存在的不足,以便為完善學(xué)習(xí)計(jì)劃,改變學(xué)習(xí)內(nèi)容與方法提供實(shí)踐依據(jù)。 對(duì)我們計(jì)算機(jī)系得學(xué)生來(lái)說(shuō),實(shí)踐能力的培養(yǎng)至關(guān)重要,而這種實(shí)踐能力的培養(yǎng)單靠課堂教學(xué)是遠(yuǎn)遠(yuǎn)不夠的,必須從課堂走向?qū)嵺`。這也是一次預(yù)演和準(zhǔn)備畢業(yè)設(shè)計(jì)工作。通過(guò)完成實(shí)驗(yàn),讓我們找出自身狀況與實(shí)際需要的差距,并在以后的學(xué)習(xí)期間及時(shí)補(bǔ)充相關(guān)知識(shí),為求職與正式工作做好充分的知識(shí)、能力準(zhǔn)備,從而縮短從校園走向社會(huì)的過(guò)渡時(shí)間。 在短短的幾個(gè)課時(shí)的實(shí)驗(yàn)之后,我們普遍感到不僅實(shí)際動(dòng)手能力有所提高,更重要的是通過(guò)對(duì)軟件開(kāi)發(fā)流程的了解,進(jìn)一步激發(fā)了我們對(duì)專業(yè)知識(shí)的興趣,并能夠結(jié)合實(shí)際存在的問(wèn)題在專業(yè)領(lǐng)域內(nèi)進(jìn)行更深入的學(xué)習(xí)。參考文獻(xiàn)[1] :清華大學(xué)出版社,[2] ,2007[3] 劉新民. Visual Basic :清華大學(xué)出版社,200433