家庭物品管理系統(tǒng)(數(shù)據(jù)庫課設(shè))_第1頁
家庭物品管理系統(tǒng)(數(shù)據(jù)庫課設(shè))_第2頁
家庭物品管理系統(tǒng)(數(shù)據(jù)庫課設(shè))_第3頁
家庭物品管理系統(tǒng)(數(shù)據(jù)庫課設(shè))_第4頁
家庭物品管理系統(tǒng)(數(shù)據(jù)庫課設(shè))_第5頁
已閱讀5頁,還剩23頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、 摘 要隨著現(xiàn)代生活的發(fā)展,我國經(jīng)濟迅速發(fā)展,人民生活水平越來越好,家家戶戶都買了各種家電和生活用品,家庭物品也就越來越豐富了。但是,我們的家庭總是有限的,對于這些家庭物品我們需要有一個系統(tǒng)的整理。通過對數(shù)據(jù)庫的學(xué)習(xí),學(xué)習(xí)了一些對數(shù)據(jù)的整理,對此,為家庭物品做了一個管理系統(tǒng)。用Visual Basic 6.0作為前端開發(fā)工具,利用其提供的集成開發(fā)環(huán)境及支持面向?qū)ο蟮母鞣N標(biāo)準(zhǔn)化的控件,尤其是對ADO的支持完成對數(shù)據(jù)庫的各種操作。使這個系統(tǒng)能夠添加、修改、刪除家庭各成員與物品的信息相關(guān)信息,當(dāng)進入到系統(tǒng)時,可以直接通過查詢用戶名或購買日期來瀏覽物品的信息,登陸到系統(tǒng)之后,就可以對房間和物品信息進行

2、添加、修改刪除了,從而完成對家庭物品的整理,使各家庭成員更加方便地了解自己家里的物品信息關(guān)鍵字: 家庭物品 整理 方便目 錄1 系統(tǒng)功能概述32 數(shù)據(jù)庫設(shè)計31.1 需求分析31.2 關(guān)系模型31.3 E-R模型41.4表結(jié)構(gòu)設(shè)計53系統(tǒng)各功能模塊的詳細設(shè)計73.1主窗體73.2登錄93.3查詢113.4用戶信息133.5物品信息183.6房間信息254參考文獻281 系統(tǒng)功能概述為該家庭物品管理系統(tǒng)設(shè)計一個MDI窗體作為主界面,在菜單欄創(chuàng)建了四個菜單:文件、查詢、添加、用戶名。(1) 文件中有兩個子菜單:登錄和退出。這兩個子菜單分別控制登錄用戶和退出整個程序。(2) 查詢中有兩個子菜單:按用

3、戶名查詢和按日期查詢。按用戶名查詢可以在用戶輸入某個用戶名之后,顯示該用戶的物品情況;按日期查找可以在輸入一個日期之后,顯示該日期之后購買的所有物品。(3) 添加中有三個子菜單:添加用戶、添加房間、添加物品。點擊添加用戶,可以對用戶信息進行增刪改查;點擊添加房間,可以對房間信息進行增刪改查操作;點擊添加物品,則可以對物品信息進行增刪改查操作。(4) 用戶名按鈕有一個子菜單:注銷。用來注銷已經(jīng)成功登錄的用戶,如沒有登錄用戶,該子菜單顯示無用戶,成功登錄之后即顯示已登錄用戶的名稱。2 數(shù)據(jù)庫設(shè)計1.1 需求分析 (1)根據(jù)家庭成員的身份,為每個成員分配有一個專門的賬號。 (2)此家庭物品系統(tǒng)管理能

4、夠添加、刪除、修改、查詢家庭成員的信息以及與房間、物品之間的聯(lián)系。(3)在進入到家庭物品管理系統(tǒng)之后,不需要登陸就可以直接查詢屬于某個人的物品信息,也可以查詢某個日期之后所購買的物品。(4)當(dāng)用戶成功登錄時,菜單欄上能夠顯示該用戶的名稱,此時,用戶才能對物品信息和家庭成員信息進行添加、修改、刪除1.2 關(guān)系模型 (1)家庭成員信息表 Uuser:userName、password、sex、age、birthday、status、profession、hobby、wage (2)物品信息表 Item:itemDate、purchaseDate、price、usedTime、quantity、pu

5、blicItem、roomNumber、category (3)房間表 Room: roomNumber、roomName (4)歸屬表 Belong:itemName、userName、itemNumber 1.3 E-R模型UuserBelongItem 整體E-R圖mnnRoomsave1圖2-1用戶信息:userNamehobbyUuserprofessionpasswordbirthdaysexwageagestatus圖2-2物品信息:ItemroomNumberpurchaseDatequantityusedTimepublicItemitemDatapricecategory圖

6、2-3房間信息:RoomroomNumberroomName圖2-4歸屬信息:BelonguserNameitemNumberitemName圖2-51.4表結(jié)構(gòu)設(shè)計Uuser表:create table Uuser (userName varchar(6) primary key, password char(6) not null , sex char(2) check (sex in('男','女'), age smallint check (age>0 and age<150), birthday datetime, status varch

7、ar(10), profession varchar(20), hobby varchar(30), wage int)圖2-6Item表:create table Item(itemName varchar(20) primary key, purchaseDate datetime, price int , usedTime datetime , quantity smallint, publicItem char(2) check(publicItem in ('是','否'), roomNumber varchar(3), category varcha

8、r(10)圖2-7Room表:create table Room(roomNumber varchar(3) primary key , roomName varchar(10), )圖2-8Belong表:create table Belong(itemName varchar(20), userName varchar(6), itemNumber smallint,primary key (itemName,userName),foreign key (itemName) references Item(itemName)on delete cascadeon update cascad

9、e,foreign key (userName) references Uuser(userName)on delete cascadeon update cascade,)圖2-93系統(tǒng)各功能模塊的詳細設(shè)計3.1主窗體主窗口設(shè)計進入主窗體之后,用戶只能有查詢的權(quán)限,用戶只有登錄成功之后才能擁有添加的權(quán)限。在添加菜單欄可以對物品、用戶、房間進行增刪改查功能。圖3-1代碼如下:Private Sub MDIForm_load()'設(shè)置加載主窗口是在電腦中間顯示,且添加按鈕不可用Move (Screen.Width - Width) / 2, (Screen.Height - Height

10、) / 2添加.Enabled = FalseEnd SubPrivate Sub 按日期_Click(Index As Integer)按日期查找.ShowEnd SubPrivate Sub 按用戶_Click(Index As Integer)按用戶查找.ShowEnd SubPrivate Sub 登陸_Click(Index As Integer)檢查是否有用戶已經(jīng)登錄If Not 用戶.Caption = "無用戶" ThenMsgBox "以檢測到登錄用戶!請先注銷再登錄!", vbDefaultButton1, "警告"

11、;Exit SubEnd If登錄.Show登錄.ScaleTop = (MDIForm1.ScaleHeight - 登錄.ScaleHeight) / 2End SubPrivate Sub 添加房間_Click(Index As Integer)房間.Show 顯示房間信息窗口End SubPrivate Sub 添加物品_Click(Index As Integer)物品.Show 顯示物品信息窗口End SubPrivate Sub 添加用戶信息_Click(Index As Integer)賬戶.Show 顯示用戶信息窗口End SubPrivate Sub 退出_Click(In

12、dex As Integer)Unload Me 退出系統(tǒng)End SubPrivate Sub 用戶_Click()If 用戶.Caption = "無用戶" ThenMsgBox "請先登錄,謝謝!", vbDefaultButton1, "提示"登錄.ShowEnd IfEnd SubPrivate Sub 注銷_Click()將主界面還原成無用戶登錄狀態(tài)用戶.Caption = "無用戶"添加.Enabled = FalseEnd Sub3.2登錄登錄窗口設(shè)計用戶只有在成功登錄之后才能點擊添加按鈕,當(dāng)輸入的用

13、戶名與數(shù)據(jù)庫中的用戶名和密碼一樣時即登錄成功,在主窗體菜單欄上顯示在線用戶的名稱,而且主窗體只能登錄一個用戶,若要切換用戶,可以在主窗體點擊注銷即可。圖3-2代碼如下:Private Sub Command1_Click()Dim a As String 定義一個常量以記錄用戶名a = Text1.TextIf Text1.Text = "" ThenMsgBox "請輸入用戶名!", vbOKOnly, "提示"Text1.SetFocusExit SubElseIf Text2.Text = "" ThenMs

14、gBox "請輸入密碼!", vbOKOnly, "提示"Text2.SetFocusExit Sub End IfEnd IfDim sqlstr As String 定義sql語句的常量sqlstr = "Select password From Uuser Where userName= '" & Text1.Text & "' "Adodc1.RecordSource = sqlstrAdodc1.RefreshIf Adodc1.Recordset.BOF Then Msg

15、Box "用戶名錯誤,重新輸入", vbExclamation, "警告" Text1.Text = ""Text1.SetFocusExit SubElse ' 判斷密碼是否正確 If Not Adodc1.Recordset.Fields("password") = Text2.Text Then MsgBox "密碼錯誤,重新輸入 ", vbExclamation, "警告"Text2.Text = ""Text2.SetFocusExit

16、Sub End If End IfMDIForm1.用戶.Caption = aIf Not MDIForm1.用戶.Caption = "無用戶" ThenMDIForm1.添加.Enabled = True 用戶成功登錄后修改主窗體End IfUnload MeEnd SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Move (MDIForm1.Width - Width) / 2, (MDIForm1.Height - Height) / 2End Sub3.3查詢(1) 按用

17、戶名查詢窗口設(shè)計 在用戶輸入一個日期之后,點擊查詢,在datagrid控件里就會顯示所輸入日期之后的所有物品的信息。圖3-3 代碼如下:Private Sub Command1_Click()Dim sqlstr3 As StringIf Text1.Text = "" ThenMsgBox "請輸入查詢用戶名!", vbDefaultButton1, "提示"Exit SubEnd Ifsqlstr3 = "Select * from byUser Where purchaseDate >= '"

18、& Text1.Text & "' "Adodc1.RecordSource = sqlstr3Adodc1.RefreshDataGrid1.Visible = True 顯示所查詢的結(jié)果End SubPrivate Sub Command2_Click()Unload Me 退回主窗體End SubPrivate Sub Form_Load()Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2End Sub(2) 按日期查詢窗口設(shè)計 在用戶輸入一個用戶名之后,在datagri

19、d控件里就會顯示此用戶的所有物品信息。圖3-4代碼如下:Private Sub Command1_Click()Dim sqlstr2 As StringIf Text1.Text = "" ThenMsgBox "請輸入查詢用戶名!", vbDefaultButton1, "提示"Exit SubEnd Ifsqlstr2 = "Select * from byUser Where userName= '" & Text1.Text & "' "Adodc2.R

20、ecordSource = sqlstr2Adodc2.RefreshDataGrid1.Visible = TrueEnd SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2End Sub3.4用戶信息用戶窗口設(shè)計 從主界面進入用戶信息界面后,可以在每個文本框里填寫新用戶的基本 信息,填寫完成后,點擊添加按鈕,彈出添加成功,即成功添加。也可以在此界面里通過輸入用戶名查找每個家庭成員的

21、基本信息,可以點擊上一個、下一個進行瀏覽。查找之后對結(jié)果也可以進行修改、刪除操作。圖3-5代碼如下:Private Sub Command1_Click()If Text1.Text = "" Or Text2.Text = "" ThenMsgBox "請輸入完整的添加信息!", vbCritical, "提醒"Else 將輸入的信息寫進數(shù)據(jù)庫中Adodc1.Recordset.Fields("userName") = Text1.TextAdodc1.Recordset.Fields(&qu

22、ot;password") = Text2.TextIf Option1.Value = True ThenAdodc1.Recordset.Fields("sex") = Label6.CaptionElseAdodc1.Recordset.Fields("sex") = Label7.CaptionEnd IfAdodc1.Recordset.Fields("birthday") = Text3.TextAdodc1.Recordset.Fields("age") = Text4.TextAdodc1

23、.Recordset.Fields("status") = Text5.TextAdodc1.Recordset.Fields("profession") = Text6.TextAdodc1.Recordset.Fields("hobby") = Text7.TextAdodc1.Recordset.Fields("wage") = Text8.TextAdodc1.RefreshMsgBox "添加用戶成功!", vbDefaultButton1, "提示"End IfE

24、nd SubPrivate Sub Command2_Click()If Text1.Text = "" Or Text2.Text = "" ThenMsgBox "請輸入完整的添加信息!", vbCritical, "提醒"ElseIf Not Text2.Text = Adodc1.Recordset.Fields("password") ThenMsgBox "密碼不正確!您無權(quán)修改!", vbCritical, "錯誤"ElseIf Option

25、1.Value = True Then Adodc1.Recordset.Fields("sex") = Label6.CaptionElseAdodc1.Recordset.Fields("sex") = Label7.CaptionEnd IfAdodc1.Recordset.Fields("birthday") = Text3.TextAdodc1.Recordset.Fields("age") = Text4.TextAdodc1.Recordset.Fields("status") =

26、 Text5.TextAdodc1.Recordset.Fields("profession") = Text6.TextAdodc1.Recordset.Fields("hobby") = Text7.TextIf Not Text8.Text = "" ThenAdodc1.Recordset.Fields("wage") = Text8.TextEnd If 更新后臺數(shù)據(jù)庫Adodc1.RefreshMsgBox "修改成功!", vbDefaultButton1, "提醒&qu

27、ot;End IfEnd IfEnd SubPrivate Sub Command3_Click()If Text1.Text = "" Or Text2.Text = "" ThenMsgBox "請輸入完整的添加信息!", vbCritical, "提醒"Else 判斷是否有刪除的權(quán)限If Not Text2.Text = Adodc1.Recordset.Fields("password") ThenMsgBox "密碼不正確!您無權(quán)刪除此用戶!", vbCritica

28、l, "錯誤"ElseAdodc1.RefreshText1.Text = ""Text2.Text = ""Option1.Value = FalseOption2.Value = FalseText3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""Text7.Text = ""Text8.Text = ""MsgBox "用戶刪除成功!&qu

29、ot;, vbDefaultButton1, "提醒"End IfEnd IfEnd SubPrivate Sub Command4_Click()Unload MeEnd SubPrivate Sub Command5_Click()If Adodc1.Recordset.EOF Then 判斷記錄指針的位置 Command5.Enabled = False Command6.Enabled = True MsgBox "已經(jīng)是最后一個用戶了!", vbDefaultButton1, "提示" Exit Sub End IfText

30、1.Text = Adodc1.Recordset.Fields("userName")Text2.Text = Adodc1.Recordset.Fields("password")If Adodc1.Recordset.Fields("sex") = "男" ThenOption1.Value = TrueElseOption2.Value = TrueEnd IfText3.Text = Adodc1.Recordset.Fields("birthday")Text4.Text = Ado

31、dc1.Recordset.Fields("age")Text5.Text = Adodc1.Recordset.Fields("status")Text6.Text = Adodc1.Recordset.Fields("profession")Text7.Text = Adodc1.Recordset.Fields("hobby")Text8.Text = Adodc1.Recordset.Fields("wage")End SubPrivate Sub Command6_Click() 將記

32、錄指針向上移 If Adodc1.Recordset.BOF Then Command6.Enabled = False Command5.Enabled = True MsgBox "已經(jīng)是第一個用戶了!", vbDefaultButton1, "提示" Exit Sub End IfText1.Text = Adodc1.Recordset.Fields("userName")Text2.Text = Adodc1.Recordset.Fields("password")If Adodc1.Recordset.

33、Fields("sex") = "男" ThenOption1.Value = TrueElseOption2.Value = TrueEnd IfText3.Text = Adodc1.Recordset.Fields("birthday")Text4.Text = Adodc1.Recordset.Fields("age")Text5.Text = Adodc1.Recordset.Fields("status")Text6.Text = Adodc1.Recordset.Fields(&q

34、uot;profession")Text7.Text = Adodc1.Recordset.Fields("hobby")Text8.Text = Adodc1.Recordset.Fields("wage")If Adodc1.Recordset.EOF ThenCommand5.Enabled = FalseEnd IfEnd SubPrivate Sub Command7_Click()Command5.Enabled = TrueCommand6.Enabled = TrueDim sql As Stringsql = "se

35、lect * from Uuser"If Text1.Text = "" Or Text2.Text = "" ThenMsgBox "請輸入用戶名和密碼!", vbCritical, "提醒"Exit SubEnd IfAdodc1.RecordSource = sqlAdodc1.RefreshIf Adodc1.Recordset.BOF Then MsgBox "無此用戶,請重新輸入", vbExclamation, "警告" Text1.Text = &q

36、uot;"Text1.SetFocusExit SubElse ' 判斷密碼是否正確 If Not Adodc1.Recordset.Fields("password") = Text2.Text Then MsgBox "密碼錯誤,重新輸入 ", vbExclamation, "警告"Text2.Text = ""Text2.SetFocusExit SubElseIf Adodc1.Recordset.Fields("sex") = "男" ThenOp

37、tion1.Value = TrueElseOption2.Value = TrueEnd IfText3.Text = Adodc1.Recordset.Fields("birthday")Text4.Text = Adodc1.Recordset.Fields("age")Text5.Text = Adodc1.Recordset.Fields("status")Text6.Text = Adodc1.Recordset.Fields("profession")Text7.Text = Adodc1.Recor

38、dset.Fields("hobby")Text8.Text = Adodc1.Recordset.Fields("wage")End IfEnd IfEnd SubPrivate Sub Form_Load()Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2Command5.Enabled = FalseCommand6.Enabled = FalseEnd Sub3.5物品信息物品窗口設(shè)計進入物品信息窗口之后,可以在文本框中輸入要添加的物品信息,然后點擊添加按鈕,彈出添加成功的

39、對話框,即添加物品信息成功!也可以通過輸入物品名稱、購買日期、是否是公用品、所有者來精確查找某條或某類物品信息。上一個、下一個可以瀏覽物品信息。修改完信息之后,也可以點擊修改按鈕來修改此物品信息。點擊刪除按鈕即可直接刪除此物品信息。退出即可直接返回主界面。圖3-6代碼如下:Private Function setNull() 構(gòu)造一個置空的函數(shù)Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Te

40、xt6.Text = ""Text7.Text = ""Text8.Text = ""Combo1.Text = ""End FunctionPrivate Sub Combo1_LostFocus()If Combo1.Text = "是" ThenLabel9.Visible = FalseText8.Visible = FalseEnd IfIf Combo1.Text = "否" ThenLabel9.Visible = TrueText8.Visible = Tru

41、eEnd IfEnd SubPrivate Sub Command1_Click()If Text1.Text = "" Or Combo1.Text = "" ThenMsgBox "請輸入添加信息!", vbCritical, "錯誤"Exit SubEnd IfIf Combo1.Text = "是" Then Adodc1.Recordset.AddNew 添加物品信息 Adodc1.Recordset.Fields("itemName") = Text1.Text

42、Adodc1.Recordset.Fields("purchaseDate") = Text2.Text Adodc1.Recordset.Fields("price") = Text3.Text Adodc1.Recordset.Fields("usedTime") = Text4.Text Adodc1.Recordset.Fields("quantity") = Text5.Text Adodc1.Recordset.Fields("category") = Text6.Text Adod

43、c1.Recordset.Fields("roomnumber") = Text7.Text Adodc1.Recordset.Fields("publicItem") = Combo1.TextAdodc1.RefreshsetNullMsgBox "添加成功!", vbDefaultButton1, "提示"Exit SubEnd IfIf Combo1.Text = "否" ThenDim sqls As Stringsqls = "select * from Item"

44、;Adodc1.RecordSource = sqls Adodc1.Recordset.Fields("itemName") = Text1.Text Adodc1.Recordset.Fields("purchaseDate") = Text2.Text Adodc1.Recordset.Fields("price") = Text3.Text Adodc1.Recordset.Fields("usedTime") = Text4.Text Adodc1.Recordset.Fields("quant

45、ity") = Text5.Text Adodc1.Recordset.Fields("category") = Text6.Text Adodc1.Recordset.Fields("roomnumber") = Text7.Text Adodc1.Recordset.Fields("publicItem") = Combo1.TextAdodc1.RefreshDim sql As Stringsql7 = "select * from Belong"Adodc1.RecordSource = sql

46、7Adodc1.Recordset.Fields("itemName") = Text1.TextAdodc1.Recordset.Fields("userName") = Text8.TextAdodc1.Recordset.Fields("itemNumber") = Text5.TextAdodc1.RefreshsetNullMsgBox "添加成功!", vbDefaultButton1, "提示"Exit SubEnd IfEnd SubPrivate Sub Command2_Cl

47、ick()If Combo1.Text = "是" Then Adodc1.Recordset.Fields("itemName") = Text1.Text Adodc1.Recordset.Fields("purchaseDate") = Text2.Text Adodc1.Recordset.Fields("price") = Text3.Text Adodc1.Recordset.Fields("usedTime") = Text4.Text Adodc1.Recordset.Field

48、s("quantity") = Text5.Text Adodc1.Recordset.Fields("category") = Text6.Text Adodc1.Recordset.Fields("roomnumber") = Text7.Text Adodc1.Recordset.Fields("publicItem") = Combo1.TextAdodc1.RefreshsetNull 調(diào)用置空函數(shù)MsgBox "修改成功!", vbDefaultButton1, "提示&q

49、uot;Exit SubEnd IfEnd SubPrivate Sub Command3_Click()Adodc1.Recordset.Delete 刪除物品信息Adodc1.RefreshMsgBox "刪除成功!", vbDefaultButton1, "提示"End SubPrivate Sub Command4_Click()Unload MeEnd SubPrivate Sub Command5_Click()Command6.Enabled = TrueCommand7.Enabled = TrueIf Not Text1.Text =

50、"" ThenDim sql1 As Stringsql1 = "Select * From item Where itemName= '" & Text1.Text & "' "Adodc1.RecordSource = sql1Adodc1.RefreshText2.Text = Adodc1.Recordset.Fields("purchaseDate")Text3.Text = Adodc1.Recordset.Fields("price")Text4.T

51、ext = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text6.Text = Adodc1.Recordset.Fields("category")Text7.Text = Adodc1.Recordset.Fields("roomnumber")Combo1.Text = Adodc1.Recordset.Fields("publicItem")If Combo1.Te

52、xt = "否" ThenText8.Text = Adodc1.Recordset.Fields("userName")End IfExit SubEnd IfIf Not Text2.Text = "" ThenDim sql2 As Stringsql2 = "Select * From items Where purchaseDate= '" & Text2.Text & "' "Adodc1.RecordSource = sql2Adodc1.Refre

53、shText1.Text = Adodc1.Recordset.Fields("itemName")Text3.Text = Adodc1.Recordset.Fields("price")Text4.Text = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text6.Text = Adodc1.Recordset.Fields("category")Text7.Text

54、= Adodc1.Recordset.Fields("roomnumber")Combo1.Text = Adodc1.Recordset.Fields("publicItem")If Combo1.Text = "否" ThenText8.Text = Adodc1.Recordset.Fields("userName")End IfExit SubEnd IfIf Not Text6.Text = "" ThenDim sql3 As Stringsql3 = "Select *

55、From items Where category= '" & Text6.Text & "' "Adodc1.RecordSource = sql3Adodc1.RefreshText1.Text = Adodc1.Recordset.Fields("itemName")Text2.Text = Adodc1.Recordset.Fields("purchaseDate")Text3.Text = Adodc1.Recordset.Fields("price")Text4

56、.Text = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text7.Text = Adodc1.Recordset.Fields("roomnumber")Combo1.Text = Adodc1.Recordset.Fields("publicItem")If Combo1.Text = "否" ThenText8.Text = Adodc1.Recordset.Fie

57、lds("userName")End IfExit SubEnd IfIf Not Text8.Text = "" ThenDim sql4 As Stringsql4 = "Select * From items Where userName= '" & Text8.Text & "' "Adodc1.RecordSource = sql4Adodc1.RefreshText1.Text = Adodc1.Recordset.Fields("itemName")

58、Text2.Text = Adodc1.Recordset.Fields("purchaseDate")Text3.Text = Adodc1.Recordset.Fields("price")Text4.Text = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text6.Text = Adodc1.Recordset.Fields("category")Text7.Tex

59、t = Adodc1.Recordset.Fields("roomnumber")Combo1.Text = Adodc1.Recordset.Fields("publicItem")If Combo1.Text = "否" ThenText8.Text = Adodc1.Recordset.Fields("userName")End IfExit SubEnd IfIf Combo1.Text = "是" ThenDim sql5 As Stringsql5 = "Select *

60、From Item Where publicItem = '" & Combo1.Text & "' "Adodc1.RecordSource = sql5Adodc1.RefreshText1.Text = Adodc1.Recordset.Fields("itemName")Text2.Text = Adodc1.Recordset.Fields("purchaseDate")Text3.Text = Adodc1.Recordset.Fields("price")Te

61、xt4.Text = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text6.Text = Adodc1.Recordset.Fields("category")Text7.Text = Adodc1.Recordset.Fields("roomnumber")Exit SubEnd IfIf Combo1.Text = "否" ThenDim sql6 As Strings

62、ql6 = "Select * From items Where publicItem = '" & Combo1.Text & "' "Adodc1.RecordSource = sql6Adodc1.RefreshText1.Text = Adodc1.Recordset.Fields("itemName")Text2.Text = Adodc1.Recordset.Fields("purchaseDate")Text3.Text = Adodc1.Recordset.Field

63、s("price")Text4.Text = Adodc1.Recordset.Fields("usedTime")Text5.Text = Adodc1.Recordset.Fields("quantity")Text6.Text = Adodc1.Recordset.Fields("category")Text7.Text = Adodc1.Recordset.Fields("roomnumber")Text8.Text = Adodc1.Recordset.Fields("userName")Exit SubEnd IfEnd SubPrivate Sub Command6_Click()If Adodc1.Recordset.EOF Then MsgBox "已經(jīng)是最后一條了!", vbDefaultButton1, "提示"

溫馨提示

  • 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

提交評論