【正文】
參考文獻(xiàn) 馬力 Visual Basic 簡(jiǎn)明教程 機(jī)械工業(yè)出版社 2021年 8 月 劉韜 駱娟 何旭洪 Visual 數(shù)據(jù)庫(kù)系統(tǒng)開發(fā)實(shí)例導(dǎo)航 人民郵電出版社 月 程序員雜志 2021 年合訂本 電子工業(yè)出版社 王小平,曹立明 .遺傳算法-理論、 應(yīng)用與軟件實(shí)現(xiàn) .西安:西安交通大學(xué)出版社, 33 。 總的來(lái)說(shuō),做完一個(gè)數(shù)據(jù)庫(kù)的收獲不僅僅是技術(shù)上的,對(duì)事情的宏觀的控制有了更深的看法。在本系統(tǒng)中,程序主界面和登陸界面的制作是比較困難的。對(duì)書本的學(xué)習(xí)完成以后,開始著手對(duì)數(shù)據(jù)庫(kù)系統(tǒng)開始制作,開始對(duì)系統(tǒng)的需求分析不足,造成多次重做。特別是對(duì)表單的作用還有視圖和報(bào)表的概念的掌握,理解不準(zhǔn)確。在設(shè)計(jì)應(yīng)用程序時(shí),應(yīng)仔細(xì)考慮每個(gè)組件提供的功能以及與其他組件之間的關(guān)系。 If = adStateOpen Then End If = adUseClient sql2, conn, adOpenStatic, adLockOptimistic 39。 amp。 amp。 amp。設(shè)置網(wǎng)格不可寫 = False = False = False Dim sql2 As String 39。使用分組統(tǒng)計(jì),并顯示在 DataGrid2 中 39。 = adUseClient sql, conn, adOpenStatic, adLockOptimistic 39。修改數(shù)據(jù)后的保存 Else End If MsgBox 保存數(shù)據(jù)成功! , vbOKOnly + vbInformation, 祝賀 39。主鍵不重復(fù),可以加入表中 For i = 0 To 6 (i) = Text1(i).Text Next i 39。 39。 amp。添加數(shù)據(jù)后保存 If add = 1 Then 28 39。保存后需要設(shè)置其他按鈕可用,以及各個(gè) text 框不可寫 = True = True = True = False = False = True = True = True = True = True For i = 0 To 14 Text1(i).Enabled = False Next i = False End Sub 27 物業(yè)管理模塊 設(shè)計(jì) 其中添加 ,修改 ,刪除按包的源碼設(shè)計(jì)同上 ,重點(diǎn)分析保存按鈕的源碼如下 : Private Sub cmdSave_Click() 39。添加保存之后,顯示總信息條數(shù)需要加 1 = Val() 1 39。 sqlCheck, conn, adOpenStatic, adLockOptimistic If Not And Not Then MsgBox 該住戶編號(hào)已經(jīng)存在,請(qǐng)重填一個(gè)! , vbOKOnly + vbInformation, 注意 Text1(0).SetFocus Text1(0).Text = Exit Sub End If 39。 (Text1(0).Text) amp。檢測(cè)住戶編號(hào)這個(gè)主鍵是否已經(jīng)在表中存在 Dim rs_check As New Dim sqlCheck As String sqlCheck = select * from Client where 住戶編號(hào) = 39。檢測(cè)數(shù)據(jù)是否完整 If Text1(0).Text = Then MsgBox 住戶編號(hào)不可為空! , vbOKOnly + vbInformation, 注意 Text1(0).SetFocus Exit Sub ElseIf Text1(1).Text = Then MsgBox 物業(yè)地址不可為空! , vbOKOnly + vbInformation, 注意 Text1(1).SetFocus Exit Sub ElseIf Text1(3).Text = Or IsNumeric(Text1(3).Text) = False Then MsgBox 建筑面積應(yīng)為數(shù)字! , vbOKOnly + vbInformation, 注意 Text1(3).SetFocus Exit Sub ElseIf Text1(4).Text = Or IsNumeric(Text1(4).Text) = False Then MsgBox 使用面積應(yīng)為數(shù)字! , vbOKOnly + vbInformation, 注意 Text1(4).SetFocus Exit Sub 25 ElseIf Text1(5).Text = Then MsgBox 業(yè)主姓名不可為空! , vbOKOnly + vbInformation, 注意 Text1(5).SetFocus Exit Sub ElseIf IsDate(Text1(13).Text) = False Then MsgBox 入住日期書寫不對(duì),應(yīng)為 202111這樣的格式! , vbOKOnly + vbInformation, 注意 Text1(13).SetFocus Exit Sub ElseIf Not Text1(14).Text = And IsDate(Text1(14).Text) = False Then MsgBox 遷出時(shí)間應(yīng)為空或 202111這樣的格式! , vbOKOnly + vbInformation, 注意 Text1(14).SetFocus Exit Sub End If 39。如果到記錄首,則表格已經(jīng)為空,置所有 text 框顯示為空 ElseIf Then For i = 0 To 14 Text1(i).Text = Next i End If 24 39。先移動(dòng) rs_client 記錄到后一條 If Then 39。刪除之后,顯示總信息條數(shù)需要減 1 = Val() 1 39。刪除當(dāng)前記錄 39。當(dāng)單擊刪除記錄時(shí),需要彈出一個(gè)提示框,警告用戶 Dim answer As String answer = MsgBox(確定要?jiǎng)h除嗎? , vbYesNo, ) 39。設(shè)置除保存和取消按鈕外的其他按鈕不可用 = False = False = False = True = True = False = False = False = False = False 39。需要清空所有 text 框,并且設(shè)置它們可寫 For i = 0 To 14 Text1(i).Text = Text1(i).Enabled = True Next i = True 39。 添加按鈕的 代碼 : Private Sub cmdAdd_Click() 39。還需使其他菜單可用