某學(xué)校公寓管理系統(tǒng)設(shè)計書.doc_第1頁
某學(xué)校公寓管理系統(tǒng)設(shè)計書.doc_第2頁
某學(xué)校公寓管理系統(tǒng)設(shè)計書.doc_第3頁
某學(xué)校公寓管理系統(tǒng)設(shè)計書.doc_第4頁
某學(xué)校公寓管理系統(tǒng)設(shè)計書.doc_第5頁
已閱讀5頁,還剩29頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

某學(xué)校公寓管理系統(tǒng)設(shè)計書 1 課題描述各個學(xué)校對學(xué)生宿舍的管理已經(jīng)有了很長的歷史,并且已經(jīng)具備了一定的規(guī)模和形態(tài),同時對學(xué)生公寓的服務(wù)和管理也要求很高.諸如對學(xué)生入住情況的詳細了解,以及來訪者的情況都要求宿舍管理人員做的好,做的完善。這樣要求公寓管理人員對學(xué)生宿舍管理進行宏觀的和微觀的細致管理,其中最好的辦法是用計算機操作的學(xué)生宿舍管理系統(tǒng)來實現(xiàn)對學(xué)生宿舍的管理。學(xué)生宿舍管理系統(tǒng)在各個學(xué)校中都具有廣泛的應(yīng)用,它具有衛(wèi)生評比、違紀(jì)處理、來客登記和房間信息功能。它不僅具有檢索迅速、查找方便、操作簡單、可靠性高、存儲量大、保密性好、壽命長和成本低的優(yōu)點,還可以極大地提高宿舍管理員的工作效率和質(zhì)量。開發(fā)工具:Visual Basic 6.02 需求分析2.1 可行性研究可行性研究的目的,就是用最小的代價在盡可能短的時間內(nèi)確定問題是否能夠解決,是否值得去解。我們從三個方面來進行可行性研究,即技術(shù)可行性、經(jīng)濟可行性和操作可行性。2. 1.1 技術(shù)可行性學(xué)生宿舍管理系統(tǒng),采用Visual Basic 6.0進行編程和界面設(shè)計,以 SQL server 2000為后臺數(shù)據(jù)庫來實現(xiàn)的,全面采用以窗口、表單、對話框和聯(lián)機幫助為特征的圖形用戶界面的技術(shù)和操作方法。系統(tǒng)操作簡單,功能大,使用方便,具有很強的技術(shù)可行性。2. 1.2經(jīng)濟可行性學(xué)生宿舍管理是一個很大的項目,在早期,還沒有利用計算機管理時,一切都是利用人工進行管理的,這樣管理起來既煩瑣又復(fù)雜,資料也很容易被丟失,而且耗時、耗資金。而利用本系統(tǒng),可以高效地對學(xué)生宿舍進行統(tǒng)一管理與控制,資料也不容易被丟失,這樣大大節(jié)省了人力與資源,提高了管理效率,給管理人員帶來很多方便。2. 1.3操作可行性操作可行性也即實用性。隨著計算機技術(shù)的發(fā)展以及網(wǎng)絡(luò)的發(fā)展,對學(xué)生宿舍的管理與控制越來越實用并且得到管理者的證實,無論是查詢還是修改都有很方便,查詢的信息一目了然。因此,它具有很強的實用性。因此本系統(tǒng)在操作上也可行。 根據(jù)上述三個方面的研究得出:可以開發(fā)本系統(tǒng)。2.2 功能需求基于系統(tǒng)需求分析,該系統(tǒng)需要實現(xiàn)以下基本功能:衛(wèi)生評比管理模塊,主要完成評比信息的錄入、修改和刪除以及評比結(jié)果的查詢功能。違紀(jì)處理管理模塊,主要完成違紀(jì)信息的錄入、修改、刪除和查詢等功能。來客登記管理模塊,主要提供來訪登記、離開登記和來訪信息查詢功能。房間信息管理模塊,主要是提供對房間信息的錄入、修改、刪除功能,同時提供房間分配和房間信息查詢功能。數(shù)據(jù)庫管理:對現(xiàn)有的數(shù)據(jù)庫進行管理,包括數(shù)據(jù)備份和恢復(fù),以方便用戶對數(shù)據(jù)庫的管理和維護工作,提高系統(tǒng)的數(shù)據(jù)安全性。2.3 性能需求系統(tǒng)運行環(huán)境:Windows 2000及其以上數(shù)據(jù)庫:SQL server 20003系統(tǒng)設(shè)計3.1系統(tǒng)層次模塊圖學(xué)生宿舍管理系統(tǒng)宿舍信息管理衛(wèi)生情況管理違規(guī)情況管理訪客信息管理衛(wèi)生情況錄入評分查詢違規(guī)處理情況錄入違規(guī)處理情況查詢來訪登記離開登記來訪查詢圖3.1 系統(tǒng)層次模塊圖3.2數(shù)據(jù)庫設(shè)計 3.2.1數(shù)據(jù)庫實體圖設(shè)計宿舍宿舍號備 注衛(wèi)生情況圖3.2 宿舍實體圖學(xué)生學(xué) 號姓 名衛(wèi)生情況班 級圖3.3 學(xué)生實體圖訪客姓 名來訪時間離開時間圖3.4 訪客實體圖3.2.2數(shù)據(jù)庫E-R圖設(shè)計宿 舍學(xué) 生訪 客宿舍信息訪客信息圖3.5宿舍管理系統(tǒng)E-R圖3.2.3數(shù)據(jù)庫關(guān)系模型設(shè)計宿舍(宿舍號,衛(wèi)生情況,備注)學(xué)生(學(xué)號,姓名,班級,違紀(jì)處理情況)宿舍信息(宿舍號,學(xué)號)訪客(姓名,來訪時間,離開時間)訪客信息(姓名,來訪時間,學(xué)號)3.2.4數(shù)據(jù)庫物理設(shè)計系統(tǒng)建立的數(shù)據(jù)庫表主要有五個,如下圖所示。字段名數(shù)據(jù)類型字段長度與格式關(guān)鍵字宿舍號varchar5是衛(wèi)生情況varchar50否備注varchar50否圖3.6“宿舍”信息表結(jié)構(gòu)字段名數(shù)據(jù)類型字段長度與格式關(guān)鍵字學(xué)號varchar5是姓名varchar50否班級varchar50否違紀(jì)處理情況varchar50否圖3.7“學(xué)生”信息表結(jié)構(gòu)字段名數(shù)據(jù)類型字段長度與格式關(guān)鍵字學(xué)號varchar5是宿舍號varchar5是圖3.8“宿舍信息”信息表結(jié)構(gòu)字段名數(shù)據(jù)類型字段長度與格式關(guān)鍵字姓名varchar50是訪問時間varchar50是離開時間varchar50否圖3.9“訪客”信息表結(jié)構(gòu)字段名數(shù)據(jù)類型字段長度與格式關(guān)鍵字學(xué)號varchar50是姓名varchar50是來訪時間varchar50否 圖3.10“訪客信息”信息表結(jié)構(gòu)3.3主控平臺界面設(shè)計充分考慮易于操作的系統(tǒng)需求,主控制平臺使用簡單和直觀的布局設(shè)計。4系統(tǒng)實現(xiàn)4.1系統(tǒng)用戶管理模塊創(chuàng)建一個系統(tǒng)登錄窗體、一個轉(zhuǎn)入窗體的主窗口窗體,利用組合框為用戶提供數(shù)據(jù),實現(xiàn)多項選擇的功能,如圖4.1所示。圖4.1 登錄窗口其主要代碼如下:Option ExplicitPublic strcon As StringPrivate Sub btnCancel_Click() txtUserName.Text = txtPassword.Text = If MsgBox(退出嗎?, vbOKCancel, 提示) = vbOK Then End End IfEnd SubPrivate Sub cmdok_Click() Rem 判斷是否為空If Len(txtUserName.Text) = 0 Then MsgBox 用戶名不能為空, vbExclamation, 警告 Exit SubEnd IfIf Len(txtPassword.Text) = 0 Then MsgBox 密碼不能為空, vbExclamation, 警告 Exit SubEnd IfRem 獲取密碼用戶 Dim struser As String struser = txtUserName.Text Dim strpw As String strpw = txtPassword.TextDim strsql As Stringstrsql = select ano as user,secret as pw from adminer Dim conn As New ADODB.ConnectionDim rst As New ADODB.RecordsetDim cmd As New ADODB.Commandconn.ConnectionString = strcon 引用公共變量 On Error GoTo conconn.Opencmd.ActiveConnection = conncmd.CommandText = strsqlSet rst = cmd.ExecuteDo Until rst.EOF If UCase(struser) = UCase(rst(user) Then If strpw = rst(pw) Then 密碼正確,顯示窗體,退出循環(huán) main.Show Unload Me rst.Close conn.Close txtUserName.Text = txtPassword.Text = Exit Sub Else 密碼錯誤 MsgBox 密碼錯誤, vbExclamation, 警告 txtPassword.Text = rst.Close conn.Close Exit Sub End IfEnd If rst.MoveNextLooprst.Closeconn.Close MsgBox 不存在該用戶, vbExclamation, 警告 txtPassword.Text = Exit Subcon:MsgBox 請確認以下設(shè)置 & Chr(13) + Chr(10) & SQL Server 服務(wù)器已經(jīng)啟動; & Chr(13) + Chr(10) & 數(shù)據(jù)庫身份驗證模式為SQL Server 和 Windows身份驗證模式End SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubPrivate Sub Label1_Click()End Sub4.2衛(wèi)生評比管理模塊創(chuàng)建一個衛(wèi)生評比管理窗體,里面包括查詢、添加和修改功能,利用Label、Textbox、Button和 DatGird等畫出如下窗體。圖4.2衛(wèi)生評分錄入界面圖4.2衛(wèi)生評分錄入界面圖4.3衛(wèi)生評分查詢界面其主要代碼如下:Public strcon As StringPrivate Sub Command1_Click() If Trim(Text1.Text) = Then MsgBox 沒有選中任何行或則學(xué)號為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String strsql = select 宿舍號 from 宿舍 Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql Set rst = cmd.ExecuteDo Until rst.EOF Dim strsno As String strsno = UCase(rst(宿舍號) rst.MoveNextLoop If strsno UCase(Text1.Text) Then MsgBox 該宿舍不存在!, vbExclamation, 提示 conn.Close Exit Sub End If strsql = update 宿舍 set 衛(wèi)生情況= & Text2.Text & where 宿舍號= & Text1.Text & Call sqlcmd(strsql) MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Exit SubmyError: MsgBox 更新失??! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空, vbExclamation, 提示End SubPrivate Sub Command2_Click()Unload MeEnd SubSub sqlcmd(strsql As String) 更新、刪除、插入數(shù)據(jù) Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql cmd.Execute conn.Close End SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubPrivate Sub Text1_Change()End SubOption ExplicitPublic blnNeedUpdate As BooleanPublic blnAdding As BooleanPublic strcon As StringPrivate Sub Command1_Click()Dim struser As StringIf Len(Text1.Text) 0 Then struser = Text1.TextElse If Len(Text2.Text) 0 Then struser = Text2.Text Else MsgBox 信息不能為空, vbExclamation, 警告 End IfEnd IfDim strsql As StringDim strsql1 As Stringstrsql = select 宿舍號 as sushe from 宿舍 Dim conn As New ADODB.ConnectionDim rst As New ADODB.RecordsetDim cmd As New ADODB.Commandconn.ConnectionString = strcon 引用公共變量conn.Opencmd.ActiveConnection = conncmd.CommandText = strsqlSet rst = cmd.ExecuteDo Until rst.EOF If UCase(struser) = UCase(rst(sushe) Thenstrsql1 = select 宿舍號,衛(wèi)生情況 from 宿舍 where 宿舍號= & Text1.Text & Call bindGrid(strsql1) Exit Sub Else strsql1 = select 宿舍號,衛(wèi)生情況 from 宿舍 where 衛(wèi)生情況= & Text2.Text & Call bindGrid(strsql1)End If rst.MoveNextLooprst.Closeconn.CloseEnd SubSub bindGrid(strsql As String)Rem 綁定datagrid Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset conn.ConnectionString = strcon 引用公共變量 conn.CursorLocation = adUseClient conn.Open rst.Open strsql, conn, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = rst.DataSource Call gridWidth End SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Command3_Click() If Trim(Text1.Text) = Then MsgBox 沒有選中任何行或則宿舍號為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String strsql = update 宿舍 set 宿舍號= & Text1.Text & ,衛(wèi)生情況= & Text2.Text & where 宿舍號= & Text1.Text & Call sqlcmd(strsql) blnAdding = False strsql = select 宿舍號,衛(wèi)生情況 from 宿舍 where 宿舍號= & Text1.Text & Call bindGrid(strsql) MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Exit SubmyError: MsgBox 更新失??! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空, vbExclamation, 提示End SubPrivate Sub Command4_Click() Text1.Locked = False Text1.Text = Text2.Text = End SubPrivate Sub DataGrid1_Click()blnAdding = False Text1.Locked = True Dim n As Integer Dim DgCount As Integer DgCount = DataGrid1.Columns.Count For n = 0 To DgCount - 1 DataGrid1.Col = n Select Case n Case 0 Text1.Text = DataGrid1.Text Case 1 Text2.Text = DataGrid1.Text End Select Next nEnd SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubSub gridWidth() Dim n As Integer Dim DgCount As Integer DgCount = DataGrid1.Columns.Count For n = 0 To DgCount - 1 DataGrid1.Columns(n).Width = Len(DataGrid1.Columns(n).Caption) * 350 DataGrid1.Col = n DataGrid1.AllowAddNew = False DataGrid1.AllowArrows = False DataGrid1.AllowDelete = False DataGrid1.AllowUpdate = False Next nEnd SubPrivate Sub DridStudent_RowColChange(LastRow As Variant, ByVal LastCol As Integer) End SubSub sqlcmd(strsql As String) 更新、刪除、插入數(shù)據(jù) Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql cmd.Execute conn.Close End Sub 4.3違紀(jì)處理管理模塊創(chuàng)建一個違紀(jì)處理管理窗體,里面包括查詢、添加和修改功能,利用Label、Textbox、Button和 DatGird等畫出如下窗體,如下圖所示。圖4.4違紀(jì)情況錄入界面圖4.5違紀(jì)情況查詢界面其主要代碼如下:Public strcon As StringPrivate Sub Command1_Click() If Trim(Text1.Text) = Then MsgBox 沒有選中任何行或則學(xué)號為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String strsql = select 學(xué)號 from 學(xué)生 Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql Set rst = cmd.ExecuteDo Until rst.EOF Dim strsno As String strsno = UCase(rst(學(xué)號) rst.MoveNext If strsno = UCase(Text1.Text) Then strsql = update 學(xué)生 set 違紀(jì)處理情況= & Text2.Text & where 學(xué)號= & Text1.Text & Call sqlcmd(strsql) MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Exit Sub End If Loop MsgBox 該學(xué)生不存在!, vbExclamation, 提示 conn.Close Exit SubmyError: MsgBox 更新失??! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空, vbExclamation, 提示End SubPrivate Sub Command2_Click()Unload MeEnd SubSub sqlcmd(strsql As String) 更新、刪除、插入數(shù)據(jù) Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql cmd.Execute conn.Close End SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End SubOption ExplicitPublic blnNeedUpdate As BooleanPublic blnAdding As BooleanPublic strcon As StringPrivate Sub Command1_Click()Dim struser As StringIf Len(Text1.Text) 0 Then struser = Text1.TextElse If Len(Text2.Text) 0 Then struser = Text2.Text Else MsgBox 信息不能為空, vbExclamation, 警告 End IfEnd IfDim strsql As StringDim strsql1 As Stringstrsql = select 學(xué)號 as sushe from 學(xué)生 Dim conn As New ADODB.ConnectionDim rst As New ADODB.RecordsetDim cmd As New ADODB.Commandconn.ConnectionString = strcon 引用公共變量conn.Opencmd.ActiveConnection = conncmd.CommandText = strsqlSet rst = cmd.ExecuteDo Until rst.EOF If UCase(struser) = UCase(rst(sushe) Then strsql1 = select 學(xué)號,違紀(jì)處理情況 from 學(xué)生 where 學(xué)號= & Text1.Text & Call bindGrid(strsql1) Exit Sub Else strsql1 = select 學(xué)號,違紀(jì)處理情況 from 學(xué)生 where 學(xué)號= & Text2.Text & Call bindGrid(strsql1)End If rst.MoveNextLooprst.Closeconn.CloseEnd SubSub bindGrid(strsql As String)Rem 綁定datagrid Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordsetconn.ConnectionString = strcon 引用公共變量 conn.CursorLocation = adUseClientconn.Open rst.Open strsql, conn, adOpenDynamic, adLockBatchOptimistic Set DataGrid1.DataSource = rst.DataSource Call gridWidth End SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Command3_Click() If Trim(Text1.Text) = Then MsgBox 沒有選中任何行或則學(xué)號為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String strsql = update 學(xué)生 set 學(xué)號= & Text1.Text & ,違紀(jì)處理情況= & Text2.Text & where 學(xué)號= & Text1.Text & Call sqlcmd(strsql) blnAdding = False strsql = select 學(xué)號,違紀(jì)處理情況 from 學(xué)生 where 學(xué)號= & Text1.Text & Call bindGrid(strsql) MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Exit SubmyError: MsgBox 更新失敗! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空, vbExclamation, 提示End SubPrivate Sub Command4_Click() Text1.Locked = False Text1.Text = Text2.Text = End SubPrivate Sub DataGrid1_Click()blnAdding = False Text1.Locked = True Dim n As Integer Dim DgCount As Integer DgCount = DataGrid1.Columns.Count For n = 0 To DgCount - 1 DataGrid1.Col = n Select Case n Case 0 Text1.Text = DataGrid1.Text Case 1 Text2.Text = DataGrid1.Text End Select Next nEnd SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubSub gridWidth() Dim n As Integer Dim DgCount As Integer DgCount = DataGrid1.Columns.Count For n = 0 To DgCount - 1 DataGrid1.Columns(n).Width = Len(DataGrid1.Columns(n).Caption) * 350 DataGrid1.Col = n DataGrid1.AllowAddNew = False DataGrid1.AllowArrows = False DataGrid1.AllowDelete = False DataGrid1.AllowUpdate = False Next nEnd SubPrivate Sub DridStudent_RowColChange(LastRow As Variant, ByVal LastCol As Integer) End SubSub sqlcmd(strsql As String) 更新、刪除、插入數(shù)據(jù) Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql cmd.Execute conn.Close End Sub 4.4來客登記管理模塊創(chuàng)建一個來訪查詢窗體,里面包括查詢、添加和修改功能,利用Label、Textbox、Button和 DatGird等畫出如下窗體,如下圖所示。圖4.6來訪登記界面圖4.7離開登記界面圖4.8來訪查詢界面其主要代碼如下: Public strcon As StringPrivate Sub Command1_Click() If Trim(Text1.Text) = Then MsgBox 訪客姓名為空!, vbInformation, 提示 Exit Sub End If If Trim(Text2.Text) = Then MsgBox 被訪人宿舍為空!, vbInformation, 提示 Exit Sub End If If Trim(Text3.Text) = Then MsgBox 被訪人姓名為空!, vbInformation, 提示 Exit Sub End If If Trim(Text4.Text) = Then MsgBox 訪問時間為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String Dim strsql1 As String strsql = select 宿舍號,姓名,學(xué)生.學(xué)號 as xuehao from 宿舍信息,學(xué)生 where 宿舍信息.學(xué)號=學(xué)生.學(xué)號 and 姓名= & Text3.Text & and 宿舍號= & Text2.Text & Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql Set rst = cmd.ExecuteDo Until rst.EOF Dim strsno As String Dim strsno1 As String Dim strsno2 As String strsno = UCase(rst(宿舍號) strsno1 = UCase(rst(姓名) strsno2 = UCase(rst(xuehao) rst.MoveNextLoop If strsno2 = 0 Then MsgBox 該學(xué)生不存在!, vbInformation, 提示 Exit Sub Else strsql1 = insert into 訪客 values( & Text1.Text & , & Text4.Text & ,) Call sqlcmd(strsql1) strsql1 = insert into 訪客信息 values( & Text1.Text & , & strsno2 & , & Text4.Text & ) Call sqlcmd(strsql1) End If MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Text3.Text = Text4.Text = Exit SubmyError: MsgBox 更新失??! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空, vbExclamation, 提示End SubPrivate Sub Command2_Click()Unload MeEnd SubSub sqlcmd(strsql As String) 更新、刪除、插入數(shù)據(jù) Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量 conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql cmd.Execute conn.Close End SubPrivate Sub Form_Load()strcon = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=學(xué)生宿舍管理系統(tǒng);server=(local)End SubPrivate Sub Label4_Click()End SubPublic strcon As StringPrivate Sub Command1_Click() If Trim(Text1.Text) = Then MsgBox 來訪人姓名為空!, vbInformation, 提示 Exit Sub End If On Error GoTo myError: Dim strsql As String strsql = select 姓名 from 訪客 Dim conn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim cmd As New ADODB.Command conn.ConnectionString = strcon 引用公共變量conn.Open cmd.ActiveConnection = conn cmd.CommandText = strsql Set rst = cmd.ExecuteDo Until rst.EOF Dim strsno As String strsno = UCase(rst(姓名) rst.MoveNext If strsno UCase(Text1.Text) Then strsql = update 訪客 set 離開時間= & Text2.Text & where 姓名= & Text1.Text & Call sqlcmd(strsql) MsgBox 執(zhí)行成功!, vbInformation, 提示 Text1.Text = Text2.Text = Exit Sub End If Loop MsgBox 該訪客不存在!, vbExclamation, 提示 conn.Close Exit Sub myError: MsgBox 更新失??! & Chr(10) + Chr(13) & 更新的數(shù)據(jù)中存在非法字符空格、單引號、雙引號、空,

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論