![基于delphi的學生成績管理系統(tǒng)_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/2/78bc0e8d-553b-421e-a998-7d423589675b/78bc0e8d-553b-421e-a998-7d423589675b1.gif)
![基于delphi的學生成績管理系統(tǒng)_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/2/78bc0e8d-553b-421e-a998-7d423589675b/78bc0e8d-553b-421e-a998-7d423589675b2.gif)
![基于delphi的學生成績管理系統(tǒng)_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/2/78bc0e8d-553b-421e-a998-7d423589675b/78bc0e8d-553b-421e-a998-7d423589675b3.gif)
![基于delphi的學生成績管理系統(tǒng)_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/2/78bc0e8d-553b-421e-a998-7d423589675b/78bc0e8d-553b-421e-a998-7d423589675b4.gif)
![基于delphi的學生成績管理系統(tǒng)_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/2/78bc0e8d-553b-421e-a998-7d423589675b/78bc0e8d-553b-421e-a998-7d423589675b5.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、南昌航空大學信息工程學院 數(shù)據(jù)庫原理 課程實驗報告 實驗名稱: 學生成績信息管理系統(tǒng)實驗時間: 2010年月2日指導教師: 班 級 : 學 號 : 姓 名 : 成 績 : 一、實驗目的(1) 通過完成從用戶需求分析、系統(tǒng)概要設計、系統(tǒng)詳細設計以及數(shù)據(jù)庫的SQL操作具體實現(xiàn)等全過程,把前面的各個實驗更好地綜合起來.(2) 進一步理解和掌握教材中的相關內容。(3) 掌握分析和設計一個大型數(shù)據(jù)庫系統(tǒng)的基本思路與方法。二、 實驗要求1. 獨立完成該系統(tǒng)的數(shù)據(jù)庫設計。2. 用SQL實現(xiàn)數(shù)據(jù)庫的設計,并在MS SQL Server上調試通過。3. 寫出查詢、更新以及建立觸發(fā)器SQL語句和執(zhí)行結果。4. 掌
2、握報表的使用。三、實驗內容綜合前面各章內容設計并調試一學生成績管理系統(tǒng),Delphi作為前臺開發(fā)工具,SQL Server完成后臺數(shù)據(jù)庫存管理。創(chuàng)建學生成績的統(tǒng)計(包括求班級各科成績的平均分);并實現(xiàn)對各科成績等的錄入、修改、刪除、查詢等功能;實現(xiàn)學生成績的統(tǒng)計(包括求班級各科成績的平均分);并實現(xiàn)對各科成績的排序。四、實驗代碼及功能注釋用戶登陸界面實驗程序:procedure TForm1.Button1Click(Sender: TObject);用戶登陸var ret:integer;beginadoconnection1.Open;with ADOStoredProc1 dobegin
3、Close;ProcedureName:='proc_login'Parameters.Clear;Parameters.Refresh;Parameters.ParamByName('username').Value:= Edit1.text;Parameters.ParamByName('password').Value:= Edit2.text;ExecProc;ret:= Parameters.ParamByName('return_value').Value;end;if ret=1 then /用戶名密碼匹配begin
4、showmessage('登陸成功');form3.show;endelseshowmessage('你不是用戶,請注冊');end ;procedure TForm1.Button2Click(Sender: TObject);若不是用戶,觸發(fā)用戶登陸界面顯示beginform2.show;end;procedure TForm1.Button3Click(Sender: TObject);退出該管理系統(tǒng)beginform1.Close;end;說明:在這里,使用了adostoredproc1控件和adoconnection1控件,它們的connections
5、tring屬性都要與所設計的數(shù)據(jù)庫相連,在查詢分析器中,要運行存儲過程如下:CREATE procedure proc_loginusername varchar(20),password varchar(20)asdeclare result intselect result=count(*) from users where username=username and passwords=passwordif result=0return 0return 1GO用戶注冊界面實驗程序:procedure TForm2.Button1Click(Sender: TObject);新用戶注冊be
6、gin adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('insert into users(username,passwords,核對密碼,性別,出生年月,聯(lián)系地址,聯(lián)系電話,郵政編碼,電子郵箱)'+'values(:1,:2,:3,:4,:5,:6,:7,:8,:9)'); adoquery1.parameters.parambyname('1').value:=''+edit1.text+'' adoquery1.parameters.param
7、byname('2').value:=''+edit2.text+'' adoquery1.parameters.parambyname('3').value:=''+edit3.text+'' adoquery1.parameters.parambyname('4').value:=''+combobox1.text+'' adoquery1.parameters.parambyname('5').value:=''+
8、combobox1.text+' '+combobox1.text+'' adoquery1.parameters.parambyname('6').value:=''+edit4.text+'' adoquery1.parameters.parambyname('7').value:=''+edit5.text+'' adoquery1.parameters.parambyname('8').value:=''+edit6.text+
9、'' adoquery1.parameters.parambyname('9').value:=''+edit7.text+'' adoquery1.execsql;end;說明:在該數(shù)據(jù)庫中,建了一個名為users的用戶表,存儲用戶的信息。只有是用戶在登陸時,才能進入主界面,當不是用戶在登陸時,必須先進行新用戶注冊,才能進入主系統(tǒng)。 系統(tǒng)主界面學生基本信息查詢精確查詢程序:procedure TForm3.Button1Click(Sender: TObject);beginwith adoquery1 dobegin if r
10、adiobutton1.Checked then /通過單選按鈕的選擇來判斷是要進行精確查詢還是模糊查詢 begin adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('select * from 學生表 where 學號='''+edit1.text+'''' ); adoquery1.Open; end;end;說明:由于學生表中,學號為主鍵,因此要查此表中學生基本信息,只要輸入主鍵值即可得一條記錄,即實現(xiàn)精確查詢。模糊查詢程序:procedure TForm3
11、.Button3Click(Sender: TObject);begin with adoquery1 do begin if radiobutton2.Checked then begin if (edit2.Text <>'')or (edit3.Text <>'')or(edit4.Text <>'')or(edit5.Text <>'') or(edit6.Text <>'')then begin adoquery1.Close; adoquery
12、1.SQL.Clear; adoquery1.SQL.Add('select * from 學生表'); adoquery1.SQL.Add('where(學號 like '''+'%'+edit2.text+'%'+''')'); adoquery1.SQL.Add('or(姓名 like '''+'%'+edit3.text+'%'+''')'); adoquery1.SQL.Add(
13、'or(所在系別 like '''+'%'+edit4.text+'%'+''')'); adoquery1.SQL.Add('or(所在專業(yè) like '''+'%'+edit5.text+'%'+''')'); adoquery1.SQL.Add('or(所在班級 like '''+'%'+edit6.text+'%'+''
14、;')'); adoquery1.Open ; end else begin application.MessageBox('沒有查詢條件','提示',mb_ok); exit; end; end; end;end;說明:當輸入的信息不是主鍵時,由于滿足該輸入條件的記錄可能不只一個,因此得到的是一個模糊查詢的結果。學生成績查詢方法與學生基本信息查詢一致。學生基本信息錄入實驗程序:procedure TForm4.Button1Click(Sender: TObject);begin adoquery1.close; adoquery1.sql.c
15、lear; adoquery1.sql.add('insert into 學生表(學號,姓名,民族,出生年月,籍貫,性別,所在系別,所在專業(yè),所在班級,政治面貌,家庭住址,郵政編碼,聯(lián)系電話)'+'values(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)'); adoquery1.parameters.parambyname('1').value:=''+edit1.text+'' adoquery1.parameters.parambyname('2')
16、.value:=''+edit2.text+'' adoquery1.parameters.parambyname('3').value:=''+edit3.text+'' adoquery1.parameters.parambyname('4').value:=''+combobox1.text+' '+combobox2.text+'' adoquery1.parameters.parambyname('5').value:=
17、9;'+edit4.text+'' adoquery1.parameters.parambyname('6').value:=''+combobox3.text+'' adoquery1.parameters.parambyname('7').value:=''+combobox4.text+'' adoquery1.parameters.parambyname('8').value:=''+edit5.text+'' adoq
18、uery1.parameters.parambyname('9').value:=''+edit6.text+'' adoquery1.parameters.parambyname('10').value:=''+edit7.text+'' adoquery1.parameters.parambyname('11').value:=''+edit8.text+'' adoquery1.parameters.parambyname('12'
19、;).value:=''+edit9.text+'' adoquery1.parameters.parambyname('13').value:=''+edit10.text+'' adoquery1.execsql;end;在SQL Server中查看錄入結果錄入前:錄入后:說明:從錄入前與錄入后表的比較看到,實現(xiàn)了學號為aaa學生基本信息的錄入。求學生平均成績、成績排序并顯示實驗程序:procedure TForm3.Button4Click(Sender: TObject);begin with adoque
20、ry1 dobegin if radiobutton3.Checked then與學生基本信息查詢一樣,這里為成績精確查詢 beginadoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('select * from 成績信息表 where 學號='''+edit9.text+'''' ); adoquery1.Open; end; if radiobutton4.Checked then與學生基本信息查詢一樣,這里為成績模糊查詢 begin if (edit10.te
21、xt <>'')or (edit11.Text <>'')or(edit12.Text <>'')or(edit13.Text <>'') or(edit14.Text <>'')then begin adoquery1.Close; adoquery1.SQL.Clear; adoquery1.SQL.Add('select * from 成績信息表'); adoquery1.SQL.Add('where(學號 like '
22、;''+'%'+edit10.text+'%'+''')'); adoquery1.SQL.Add('or(姓名 like '''+'%'+edit11.text+'%'+''')'); adoquery1.SQL.Add('or(所在系別 like '''+'%'+edit12.text+'%'+''')'); adoque
23、ry1.SQL.Add('or(所在專業(yè) like '''+'%'+edit13.text+'%'+''')'); adoquery1.SQL.Add('or(所在班級 like '''+'%'+edit14.text+'%'+''')'); adoquery1.Open ; end else begin application.MessageBox('沒有查詢條件','提示
24、9;,mb_ok); exit; end; end; if radiobutton9.Checked then求每個學生的課程平均成績 begin adoquery1.Close ; sql.Clear ; sql.Add('select 學號,姓名,AVG(成績) as 平均成績 from 成績信息表 where 所在班級=''070413'' group by 學號,姓名'); adoquery1.Open ; end; if radiobutton11.Checked then將學生成績按從低到高排序 begin adoquery1.Clo
25、se ; sql.Clear ; sql.Add('select 學號,姓名,avg(成績) as 平均成績 from 成績信息表 group by 學號,姓名 order by 平均成績'); adoquery1.open; end;end;end;求平均成績界面與平均成績排序后界面:說明:使用到了數(shù)據(jù)庫的自帶函數(shù)avg() 來求平均成績,按平均成績排序時,只要在已經做好的平均成績顯示程序上加上order by 語句即可。學生基本信息刪除與修改實驗程序:procedure TForm3.Button6Click(Sender: TObject);begin with adoq
26、uery1 do begin if radiobutton7.Checked then begin adoquery1.Close ; adoquery1.SQL.Clear ; adoquery1.SQL.Add('update 學生表 set '+combobox1.text+'='''+edit19.text+''''); /edit19 編輯框用來輸入要更改的字段名 adoquery1.SQL.Add('where 學號='''+edit18.text+''''); adoquery1.execsql; end; if radiobutton8.Checked then begin a
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 魯人版道德與法治九年級上冊6.1《人與自然息息相關》配套聽課評課記錄
- 人教版地理八年級上冊《第一節(jié) 交通運輸》聽課評課記錄4
- 安徽省考編數(shù)學試卷
- 湖南省瀏陽市中學八年級地理上冊 第二章 第一節(jié) 中國的地形說課稿 (新版)湘教版
- 蘇科版版數(shù)學七年級上冊聽評課記錄《2-6 有理數(shù)的乘法與除法》第2課時
- 教育策略新解
- 2025年度人工智能技術研發(fā)合作合同范本-@-4
- 湘教版數(shù)學九年級上冊3.4.2《相似三角形的性質》聽評課記錄
- 現(xiàn)代化教育體系下的化工工程教育設計
- 現(xiàn)代物流業(yè)對城市經濟發(fā)展的影響研究
- 西門子starter軟件簡易使用手冊
- 暢捷通g6財務管理系統(tǒng)專業(yè)版使用手冊
- 2022注冊電氣工程師專業(yè)考試規(guī)范清單匯總
- 隧道施工監(jiān)控量測方案及措施
- 桂花-作文ppt-PPT課件(共14張)
- 配電房日常檢查記錄表.docx
- 高一數(shù)學概率部分知識點總結及典型例題解析 新課標 人教版 必修
- 鐵路運費計算方法
- 《小腦梗死護理查房》
- 免疫及炎癥相關信號通路
- 某風電場設備材料設備清單
評論
0/150
提交評論