_數(shù)據(jù)庫實(shí)訓(xùn)-轎車銷售管理系統(tǒng).doc_第1頁
_數(shù)據(jù)庫實(shí)訓(xùn)-轎車銷售管理系統(tǒng).doc_第2頁
_數(shù)據(jù)庫實(shí)訓(xùn)-轎車銷售管理系統(tǒng).doc_第3頁
_數(shù)據(jù)庫實(shí)訓(xùn)-轎車銷售管理系統(tǒng).doc_第4頁
_數(shù)據(jù)庫實(shí)訓(xùn)-轎車銷售管理系統(tǒng).doc_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

轎車銷售管理系統(tǒng)學(xué)號(hào):11041216 班級(jí):計(jì)算機(jī)科學(xué)與技術(shù)11-2姓名:張文濤引言:本系統(tǒng)采用Visual Basic 6.0 和SQL Server 2008來建立一個(gè)簡(jiǎn)單的轎車銷售管理系統(tǒng)。基本功能包括:轎車信息管理、客戶信息管理、員工信息管理等功能。詳細(xì)描述如下:1系統(tǒng)用戶管理功能:用戶根據(jù)姓名和密碼登錄系統(tǒng)。登錄用戶分為兩個(gè)等級(jí):普通用戶和管理員用戶。(1)普通用戶:只有查看轎車信息、客戶信息、員工信息等功能;(2)管理員用戶(admin):除了以上功能外,同時(shí)還有添加用戶、修改用戶密碼和刪除用戶的功能。2轎車信息管理功能:錄入所銷售的轎車的編號(hào)、型號(hào)、品牌、價(jià)格、保修期等信息,同時(shí)支持對(duì)轎車信息的添加、修改、刪除和查詢功能。3客戶信息管理功能:錄入購(gòu)買的客戶的姓名、性別、年齡、聯(lián)系方式、所購(gòu)車型號(hào)、購(gòu)車價(jià)格等信息,同時(shí)支持對(duì)客戶信息的添加、修改、刪除和查詢功能。4員工信息管理功能:錄入員工的員工號(hào)、姓名、性別等信息,同時(shí)支持對(duì)員工信息的添加、修改、刪除和查詢功能。一、系統(tǒng)功能系統(tǒng)的控制流程圖如下所示:登錄修改用戶密碼查詢用戶密碼系統(tǒng)用戶刪除系統(tǒng)用戶管理功能轎車信息管理功能客戶信息管理功能員工信息管理功能轎車信息查詢轎車信息添加轎車信息修改轎車信息刪除客戶信息查詢客戶信息添加客戶信息修改客戶信息刪除員工信息查詢員工信息添加員工信息修改員工信息刪除系統(tǒng)用戶添加本系統(tǒng)主要需要實(shí)現(xiàn)對(duì)轎車信息、客戶信息和員工信息的管理。具體實(shí)現(xiàn)的功能包括:1系統(tǒng)用戶管理功能:用戶根據(jù)姓名和密碼登錄系統(tǒng)。登錄用戶分為兩個(gè)等級(jí):普通用戶和管理員用戶。(1)普通用戶:只有查看轎車信息、客戶信息、員工信息等功能;(2)管理員用戶(Adimn):除了以上功能外,同時(shí)還有添加用戶、修改用戶密碼和刪除用戶的功能。2轎車信息管理功能: 錄入所銷售的轎車的編號(hào)、型號(hào)、品牌、價(jià)格、保修期等信息,同時(shí)支持對(duì)轎車信息的添加、修改、刪除和查詢、統(tǒng)計(jì)功能。3客戶信息管理功能:錄入購(gòu)買的客戶的姓名、性別、年齡、聯(lián)系方式、所購(gòu)車型號(hào)、購(gòu)車價(jià)格等信息,同時(shí)支持對(duì)客戶信息的添加、修改、刪除和查詢、統(tǒng)計(jì)功能。4員工信息管理功能:錄入員工的員工號(hào)、姓名、性別等信息,同時(shí)支持對(duì)員工信息的添加、修改、刪除和查詢、統(tǒng)計(jì)功能。二、概念模型設(shè)計(jì)系統(tǒng)用戶員工信息客戶信息轎車信息管理用戶名密 碼用戶等級(jí)類型描述用戶級(jí)別轎車型號(hào)轎車編號(hào)轎車品牌轎車價(jià)格轎車保修期轎車具體描述客戶編號(hào)客戶年齡客戶職業(yè)身份證號(hào)客戶電話客戶住址購(gòu)車價(jià)格購(gòu)車型號(hào)客戶性別客戶姓名員工編號(hào)員工性別員工姓名員工電話員工職務(wù)員工生日員工地址進(jìn)入公司時(shí)間所在部門用E-R圖描述本系統(tǒng)的數(shù)據(jù)庫設(shè)計(jì)。三、數(shù)據(jù)庫設(shè)計(jì)1數(shù)據(jù)庫設(shè)計(jì)創(chuàng)建“轎車銷售管理系統(tǒng)”數(shù)據(jù)庫,庫名為CarSaleSys,其中數(shù)據(jù)文件初始大小為1MB,最大大小不受限制,允許數(shù)據(jù)庫自動(dòng)增長(zhǎng),增長(zhǎng)方式是按10%增長(zhǎng);日志文件初始大小為1MB,最大大小不受限制,增長(zhǎng)方式是按10%增長(zhǎng)。CarSaleSys系統(tǒng)中包含5個(gè)數(shù)據(jù)庫表:用戶信息表Users、用戶類型表UserType、轎車信息表Car、客戶信息表Customer、員工信息表Staff。2數(shù)據(jù)庫表設(shè)計(jì)數(shù)據(jù)庫中各表的結(jié)構(gòu)分別如下:(1)Users表字段名稱數(shù)據(jù)類型是否允許空值約束說明User_namevarchar(10)主鍵用戶名User_pwdvarchar(20)用戶密碼User_typesmallint外鍵用戶等級(jí)(2)UserType表字段名稱數(shù)據(jù)類型是否允許空值約束說明User_typesmallint主鍵用戶等級(jí)(限制用戶權(quán)限)Type_discriptionvarchar(50)唯一值類型描述(3)Car表字段名稱數(shù)據(jù)類型是否允許空值約束說明Car_idint主鍵轎車編號(hào)Car_namevarchar(20)主鍵轎車型號(hào)Car_brandvarchar(20)轎車品牌Car_priceint轎車價(jià)格Car_timevarchar(10)轎車保修期Car_infovarchar(100)轎車具體描述(4)Customer表字段名稱數(shù)據(jù)類型是否允許空值約束說明Customer_idint主鍵客戶編號(hào)Customer_namevarchar(10)客戶姓名Customer_sexvarchar(2)客戶性別Customer_ageint客戶年齡Customer_occupvarchar(10)客戶職業(yè)Customer_numvarchar(20)身份證號(hào)Customer_telvarhcar(10)客戶電話Customer_addrvarchar(20)客戶住址Buy_carvarchar(20)外鍵購(gòu)車型號(hào)Buy_pricevarchar(10)購(gòu)車價(jià)格Infovarchar(100)備注(客戶的其他信息)(5)Staff表字段名稱數(shù)據(jù)類型是否允許空值約束說明Staff_ifint主鍵員工編號(hào)Staff_namevarchar(10)員工姓名Staff_sexvarchar(2)員工性別Staff_birthdatetime(8)員中生日Staff_intimedatetime(8)進(jìn)入公司時(shí)間Staff_departvarchar(10)所在部門Staff_titlevarchar(10)員工職務(wù)Staff_telvarchar(10)員工電話Staff_addrvarchar(20)員工住址3數(shù)據(jù)庫表內(nèi)容數(shù)據(jù)庫中各表的數(shù)據(jù)內(nèi)容分別如下:(1)Users表(2)UserType表(3)Car表(4)Customer表(5)Staff表四、VB開發(fā)設(shè)計(jì)一)登錄界面設(shè)計(jì)1程序界面當(dāng)系統(tǒng)運(yùn)行時(shí),首先啟動(dòng)轎車銷售管理登錄界面Frm_login。設(shè)置多窗體的啟動(dòng)窗體為Frm_login。程序運(yùn)行界面如下,根據(jù)運(yùn)行界面添加相應(yīng)控件及進(jìn)行相應(yīng)屬性的設(shè)置。注意:添加一個(gè)Adodc1,設(shè)置Adodc控件的ConnectionString屬性,在屬性頁中選擇“使用ODBC數(shù)據(jù)源名稱”。2登陸界面代碼Public PasswordKey As StringPublic namekey As StringPublic try_times As IntegerPrivate Sub cmd_Yes_Click() Dim j As Single If txtUname = Then MsgBox 請(qǐng)輸入用戶名 txtUname.SetFocus Exit Sub End If If txtUpwd = Then MsgBox 請(qǐng)輸入密碼 txtUpwd.SetFocus Exit Sub End If namekey = Trim(txtUname.Text) PasswordKey = Trim(txtUpwd.Text) Adodc1.RecordSource = select * from Users where User_name= + namekey + Adodc1.Refresh If Adodc1.Recordset.EOF = True Then MsgBox 用戶不存在 try_times = try_times + 1 If try_times = 3 Then MsgBox 您已經(jīng)三次嘗試進(jìn)入本系統(tǒng),均不成功,系統(tǒng)將關(guān)閉 Exit Sub Else Exit Sub End If End If If PasswordKey Adodc1.Recordset.Fields(1) Then MsgBox 密碼錯(cuò)誤 try_times = try_times + 1 If try_times = 3 Then MsgBox 您已經(jīng)三次嘗試進(jìn)入本系統(tǒng),均不成功,系統(tǒng)將關(guān)閉 Exit Sub Else Exit Sub End If End If If Adodc1.Recordset.Fields(2) = 1 Then frm_Main.Menu_addcar.Enabled = False frm_Main.Menu_addcus.Enabled = False frm_Main.Menu_addemp.Enabled = False frm_Main.Menu_adduser.Enabled = False frm_edit_car.cmdChange = False frm_edit_car.cmdDel = False frm_edit_cus.cmdChange = False frm_edit_cus.cmdDel = False Frm_edit_emp.cmdChange = False Frm_edit_emp.cmdDel = False frm_Main.Menu_edit_user.Enabled = False ElseIf Adodc1.Recordset.Fields(2) 0 Then MsgBox (用戶類型錯(cuò)誤) Exit Sub End If Unload Me frm_Main.Show End Sub(2) 轎車銷售管理系統(tǒng)的主界面1程序界面主界面具體設(shè)置如下表:主菜單及下級(jí)子菜單屬性設(shè)置,然后添加對(duì)應(yīng)的窗體,修改窗體名稱屬性。級(jí)別菜單名稱單擊鏈接窗口主菜單系統(tǒng)用戶管理MenuUser子菜單添加用戶Menu_adduserFrm_adduser.show查看/修改密碼Menu_edit_userFrm_edit_user.show主菜單轎車信息管理Menu_carinfo子菜單查看轎車信息Menu_quecarFrm_quecar.show修改/刪除轎車信息Menu_edit_carFrm_edit_car.show增加轎車信息Menu_addcarFrm_addcar.show主菜單客戶信息管理Menu_customerinfo子菜單查看客戶信息Menu_quecusFrm_quecus.show修改/刪除客戶信息Menu_edit_cusFrm_edit_cus.show增加客戶信息Menu_addcusFrm_addcus.show主菜單員工信息管理Menu_ employeeinfo子菜單查看員工信息Menu_queempFrm_queemp.show修改/刪除員工信息Menu_modiempFrm_edit_emp.show增加員工信息Menu_addempFrm_addemp.show主菜單退出系統(tǒng)Menu_exit2主要代碼:Private Sub Menu_addcar_Click() Frm_addcar.ShowEnd SubPrivate Sub Menu_addcus_Click() Frm_addcus.ShowEnd SubPrivate Sub Menu_addemp_Click() Frm_addemp.ShowEnd SubPrivate Sub Menu_adduser_Click() Frm_adduser.ShowEnd SubPrivate Sub Menu_edit_car_Click() Frm_edit_car.ShowEnd SubPrivate Sub Menu_edit_cus_Click() Frm_edit_cus.ShowEnd SubPrivate Sub Menu_edit_use_Click() Frm_edit_user.ShowEnd SubPrivate Sub Menu_modiemp_Click() Frm_edit_emp.ShowEnd SubPrivate Sub Menu_quecar_Click() Frm_quecar.ShowEnd SubPrivate Sub Menu_quecus_Click() Frm_quecus.ShowEnd SubPrivate Sub Menu_queemp_Click() Frm_queemp.ShowEnd Sub(三)系統(tǒng)用戶管理功能1添加用戶窗體在轎車銷售管理系統(tǒng)的主界面中,單擊“添加用戶”選項(xiàng),啟動(dòng)frm_adduser.show,進(jìn)入“添加用戶”界面,如下所示: 單擊“取消”按鈕,將觸發(fā)cmd_cancel_click事件,不保存輸入文本框的內(nèi)容而直接返回到主界面。單擊“確定”按鈕,將觸發(fā)cmd_ok_click事件,把輸入的用戶信息添加到SQL Server對(duì)應(yīng)的數(shù)據(jù)庫表中。具體代碼如下:主要代碼:Private Sub cmdYes_Click()Dim usertype As Integer數(shù)據(jù)有效性檢查If txtUname = Then MsgBox 請(qǐng)輸入用戶名 txtUname.SetFocus Exit SubEnd IfAdodc1.RecordSource = select * from Users where User_name= + Trim(txtUname.Text) + Adodc1.RefreshIf Adodc1.Recordset.EOF = False Then MsgBox 已經(jīng)有此用戶,請(qǐng)重新輸入 txtUname.SetFocus Exit SubElse If txtUpwd = Then MsgBox 請(qǐng)輸入密碼 txtUpwd.SetFocus Exit Sub End If If txtURpwd = Then MsgBox 請(qǐng)確認(rèn)密碼 txtURpwd.SetFocus Exit Sub ElseIf txtURpwd.Text txtUpwd.Text Then MsgBox 密碼不一致 txtURpwd.SetFocus Exit Sub End If If Option1 = True Then usertype = 0 ElseIf Option2 = True Then usertype = 1 Else MsgBox 請(qǐng)選擇用戶類型 Exit Sub End If If Len(txtUpwd) 6 Then MsgBox 密碼長(zhǎng)度不能小于6 txtUpwd.SetFocus txtUpwd.SelStart = 0 txtUpwd.SelLength = Len(txtUpwd) Exit Sub End If 添加新用戶 Adodc1.Recordset.AddNew Adodc1.Recordset.Fields(0).Value = Trim(txtUname.Text) Adodc1.Recordset.Fields(1).Value = Trim(txtUpwd.Text) Adodc1.Recordset.Fields(2).Value = usertype Adodc1.Recordset.Update Adodc1.Refresh MsgBox 用戶增加成功 Unload Me End ifEnd Sub2“查看/修改密碼”窗體單擊“查看修改密碼”選項(xiàng),啟動(dòng)Frm_edit_User.show,進(jìn)入“用戶列表”界面,如下圖所示。主要代碼:下面的Form_Load()事件代碼,是在窗體加載時(shí)用代碼連接數(shù)據(jù)庫,不用設(shè)置Adodc控件的ConnectionString屬性??梢蕴砑右粋€(gè)模塊,在模塊中定義一個(gè)連接字符串函數(shù),然后在Form_Load()事件中調(diào)用連接函數(shù)conStr。注意:后面涉及Adodc控件的連接都可以用一行代碼“Adodc1.ConnectionString = cnStr”調(diào)用在模塊中已經(jīng)定義的連接字符串函數(shù)。Private Sub Cmd_del_Click() Dim username As String If Adodc1.Recordset.EOF = True Then MsgBox 請(qǐng)選擇記錄 Exit Sub End If 通過Adodc1.Recordset.Fields()讀取Adodc1記錄源中的當(dāng)前數(shù)據(jù) username = Adodc1.Recordset.Fields(0) 詢問用戶是否確認(rèn)刪除 If MsgBox(是否刪除當(dāng)前行?, vbYesNo, 確認(rèn)) = vbYes Then Adodc1.RecordSource = Select * From Users Where User_name = + username + Adodc1.Refresh Adodc1.Recordset.Delete Adodc1.Recordset.Update End If 刷新DataGrid表格的內(nèi)容 Adodc1.RecordSource = SELECT u.User_name, u.User_Pwd, t.Type_discription As User_disc FROM Users u, UserType t Where t.User_type = u.User_type Adodc1.RefreshEnd SubPrivate Sub Cmd_modi_Click()If Adodc1.Recordset.EOF = True Then MsgBox 請(qǐng)選擇記錄 Exit Sub End If 通過Adodc1.Recordset.Fields()讀取Adodc1記錄源中的當(dāng)前數(shù)據(jù) Frm_modiuser.oldPwd = Adodc1.Recordset.Fields(1) Frm_modiuser.username = Adodc1.Recordset.Fields(0) Frm_modiuser.ShowEnd SubPrivate Sub Form_Load() Dim i As Integer Adodc1.RecordSource = SELECT u.User_name, u.User_Pwd, t.Type_discription As User_disc FROM Users u, UserType t Where t.User_type = u.User_type Adodc1.RefreshEnd Sub修改密碼界面如下:修改密碼代碼如下:Private Sub cmdYes_Click() Dim cnn As ADODB.Connection Dim rs As ADODB.Recordset cnn.ConnectionString = Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=CarSaleSys;Data Source=(local) cnn.ConnectionString = MStr() cnn.Open Set rs = cnn.Execute(select count(*) from Users where User_name= + Trim(txtUname.Text) + and User_pwd= + Trim(txtOldpwd.Text) + ) If txtUname.Text = Then MsgBox (請(qǐng)輸入用戶名) Exit Sub End If If txtOldpwd.Text = Then MsgBox (請(qǐng)輸入舊密碼) Exit Sub End If If txtNpwd.Text = Then MsgBox (請(qǐng)輸入新密碼) Exit Sub End If If txtRpwd.Text = Then MsgBox (請(qǐng)確認(rèn)新密碼) Exit Sub End If If txtRpwd.Text txtNpwd.Text Then MsgBox (新密碼與確認(rèn)密碼不正確) Exit Sub End If If rs.EOF Then MsgBox (請(qǐng)確認(rèn)用戶名,密碼) Exit Sub Else Set rs = cnn.Execute(update Users set User_pwd= + Trim(txtNpwd.Text) + where User_name= + Trim(txtUname.Text) + ) If Not rs.EOF Then MsgBox (數(shù)據(jù)更新成功) Unload Me Exit Sub Else MsgBox (未知錯(cuò)誤) Unload Me Exit Sub End If End If End Sub(四)轎車信息管理功能1轎車信息查詢(1)程序運(yùn)行界面(2)主要代碼Private Sub cmdYes_Click() If Option1 = True Then If txtxinghao.Text Then Adodc1.RecordSource = select Car_name,Car_brand,Car_price,Car_time,Car_info from Car where Car_name like % + Trim(txtxinghao.Text) + % Adodc1.Refresh End If End If If Option2 = True Then If txtpinpai.Text Then Adodc1.RecordSource = select Car_name,Car_brand,Car_price,Car_time,Car_info from Car where Car_brand like % + Trim(txtpinpai.Text) + % Adodc1.Refresh End If End If If Option3 = True Then If txtLow.Text And txtUp.Text Then Adodc1.RecordSource = select Car_name,Car_brand,Car_price,Car_time,Car_info from Car where Car_price between + Trim(txtLow.Text) + and + Trim(txtUp.Text) + Adodc1.Refresh End If End IfEnd SubPrivate Sub Form_Load()Adodc2.RecordSource = select count(*) from CarAdodc2.RefreshText1.Text = Adodc2.Recordset.Fields(0)End SubPrivate Sub Option1_Click() Call fresh txtxinghao.Text = txtpinpai.Text = txtLow.Text = txtUp.Text = txtxinghao.Enabled = True txtpinpai.Enabled = False txtLow.Enabled = False txtUp.Enabled = FalseEnd SubPublic Sub fresh() Adodc1.RecordSource = select Car_name,Car_brand,Car_price,Car_time,Car_info from car Adodc1.RefreshEnd SubPrivate Sub Option3_Click() txtName.Text = txtName.Enabled = False txtBrand.Text = txtBrand.Enabled = False txtPrice.Enabled = TrueEnd Sub2轎車信息修改與刪除(1)程序運(yùn)行界面(2)主要代碼修改記錄:Private Sub cmdChange_Click()curId = Adodc1.Recordset.Fields(0)Adodc1.Recordset.Fields(1).Value = Trim(txtxinghao.Text)Adodc1.Recordset.Fields(2).Value = Trim(txtpinpai.Text)Adodc1.Recordset.Fields(3).Value = Val(Trim(txtprice.Text)Adodc1.Recordset.Fields(4).Value = Trim(txttime.Text)Adodc1.Recordset.Fields(5).Value = Trim(txtinfo.Text)Adodc1.Recordset.UpdateMsgBox (轎車記錄已修改)Adodc1.RecordSource = select * from CarAdodc1.RefreshDo While Adodc1.Recordset.Fields(0) curId Adodc1.Recordset.Move (1) LoopEnd SubPrivate Sub cmdDel_Click()Adodc1.Recordset.DeleteAdodc1.Recordset.UpdateMsgBox (轎車記錄已刪除)Adodc1.RecordSource = select * from CarAdodc1.RefreshEnd SubPrivate Sub cmdFirst_Click() Adodc1.Recordset.MoveFirst cmdhead.Enabled = False cmdNext.Enabled = TrueEnd SubPrivate Sub cmdhead_Click() If cmdNext.Enabled = False Then cmdNext.Enabled = True End If Adodc1.Recordset.MovePrevious If Adodc1.Recordset.Fields(0) = firstId Then cmdhead.Enabled = False End IfEnd SubPrivate Sub cmdLast_Click() Adodc1.Recordset.MoveLast cmdNext.Enabled = False cmdhead.Enabled = TrueEnd SubPrivate Sub cmdnext_Click() If cmdhead.Enabled = False Then cmdhead.Enabled = True End If Adodc1.Recordset.MoveNext If Adodc1.Recordset.Fields(0) = lastId Then cmdNext.Enabled = False End If End SubPrivate Sub Form_Load() Adodc1.RecordSource = select * from Car Adodc1.Refresh If Adodc1.Recordset.RecordCount 0 Then Adodc1.Recordset.MoveLast lastId = Adodc1.Recordset.Fields(0) Adodc1.Recordset.MoveFirst firstId = Adodc1.Recordset.Fields(0) End If cmdhead.Enabled = False If Adodc1.Recordset.RecordCount = 1 Then cmdNext.Enabled = False End IfEnd Sub3轎車信息錄入(1)程序運(yùn)行界面(2)主要代碼Private Sub cmdYes_Click() Dim txtID As Integer Adodc1.RecordSource = select * from car order by Car_id asc Adodc1.Refresh If txtpinpai.Text = Then MsgBox (請(qǐng)輸入汽車品牌) Exit Sub End If If txtprice.Text = Then MsgBox (請(qǐng)輸入汽車價(jià)格) Exit Sub End If If txtxinghao.Text = Then MsgBox (請(qǐng)輸入汽車型號(hào)) Exit Sub End If If txttime.Text = Then MsgBox (請(qǐng)輸入汽車保修期) Exit Sub End If Adodc1.Recordset.AddNew Adodc1.Recordset.Fields(1).Value = Trim(txtxinghao.Text) Adodc1.Recordset.Fields(2).Value = Trim(txtpinpai.Text) Adodc1.Recordset.Fields(3).Value = Val(Trim(txtprice.Text) Adodc1.Recordset.Fields(4).Value = Trim(txttime.Text) Adodc1.Recordset.Fields(5).Value = Trim(txtinfo.Text) Adodc1.Recordset.Update Adodc1.Refresh MsgBox (汽車信息添加完成) Unload MeEnd Sub(五)客戶信息管理功能在客戶信息系統(tǒng)中需要設(shè)計(jì)實(shí)現(xiàn)如下所示功能。1單擊“查看客戶信息”選項(xiàng),啟動(dòng)frm_queCus.Show,進(jìn)入“查詢顧客”界面。主要代碼Private Sub cmdYes_Click() If Option1 = True Then If txtname.Text Then Adodc1.RecordSource = select * from Customer where Customer_name like % + Trim(txtname.Text) + % Adodc1.Refresh Else MsgBox (請(qǐng)輸入查詢條件) End If End If If Option2 = True Then If txtsex.Text Then Adodc1.RecordSource = select * from Customer where Customer_sex like % + Trim(txtsex.Text) + % Adodc1.Refresh Else MsgBox (請(qǐng)輸入查詢條件) End If End If If Option3 = True Then If txtxinghao.Text Then Adodc1.RecordSource = select * from Customer where Buy_car like % + Trim(txtxinghao.Text) + % Adodc1.Refresh Else MsgBox (請(qǐng)輸入查詢條件) End If End IfEnd Sub2單擊“修改/刪除客戶信息”選項(xiàng),啟動(dòng)frm_edit_Cus.Show,進(jìn)入編輯客戶信息界面。主要代碼:修改:Private Sub cmdChange_Click()If txtname.Text = Then MsgBox (客戶姓名不能為空) Exit SubEnd IfIf txtsex.Text = Then MsgBox (客戶性別不能為空) Exit SubEnd IfIf txtxinghao.Text = Then MsgBox (購(gòu)車型號(hào)不能為空) Exit SubEnd IfIf txtprice.Text = Then MsgBox (購(gòu)車價(jià)格不能為空) Exit SubEnd Ifconn.ConnectionString = MStr()conn.OpenSet rs = conn.Execute(select count(*) from Car where Car_name= + Trim(txtxinghao.Text) + )If rs.EOF Then MsgBox (沒有該汽車型號(hào),請(qǐng)?zhí)砑釉撈囆吞?hào)) Exit SubEnd IfcurId = Adodc1.Recordset.Fields(0)Adodc1.Recordset.Fields(1).Value = Trim(txtname.Text)Adodc1.Recordset.Fields(2).Value = Trim(txtsex.Text)Adodc1.Recordset.Fields(3).Value = Trim(txtage.Text)Adodc1.Recordset.Fields(4).Value = Trim(txtjob.Text)Adodc1.Recordset.Fields(5).Value = Trim(txtnum.Text)Adodc1.Recordset.Fields(6).Value = Trim(txttel.Text)Adodc1.Recordset.Fields(7).Value = Trim(txtaddr.Text)Adodc1.Recordset.Fields(8).Value = Trim(txtxinghao.Text)Adodc1.Recordset.Fields(9).Value = Trim(txtprice.Text)Adodc1.Recordset.Fields(10).Value = Trim(txtinfo.Text)Adodc1.Recordset.UpdateMsgBox (客戶信息已修改)Adodc1.RecordSource = select * from CustomerAdodc1.RefreshDo While Adodc1.Recordset.Fields(0) curId Adodc1.Recordset.Move (1) LoopEnd SubPrivate Sub cmdDel_Click()Adodc1.Recordset.DeleteAdodc1.Recordset.UpdateMsgBox (客戶信息已刪除)Adodc1.RecordSource = select * from CustomerAdodc1.RefreshEnd SubPrivate Sub cmdFirst

溫馨提示

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

評(píng)論

0/150

提交評(píng)論