數(shù)據(jù)庫課程設計--成績管理系統(tǒng)知識講解_第1頁
數(shù)據(jù)庫課程設計--成績管理系統(tǒng)知識講解_第2頁
數(shù)據(jù)庫課程設計--成績管理系統(tǒng)知識講解_第3頁
數(shù)據(jù)庫課程設計--成績管理系統(tǒng)知識講解_第4頁
已閱讀5頁,還剩28頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、數(shù)據(jù)庫課程設計- - 成績管理系統(tǒng)實習報告實習名稱 : 數(shù)據(jù)結(jié)構(gòu)與數(shù)據(jù)庫課程設計系部名稱 : 測繪工程學院專業(yè)班級 : 測繪 11-3 班學生姓名 : 黃第科學號: 20110222指導教師:梁欣黑龍江工程學院教務處制實習名稱數(shù)據(jù)結(jié)構(gòu)與數(shù)據(jù)庫課程設計實習時間2012年12月17日至2012年12月28日共2周實習單位或?qū)嵙暤攸c同組成員實驗樓 601、606、612一人評分指標與分值得分總分實習態(tài)度 (工作態(tài)度是否積極,是否缺勤、違紀,團結(jié)、協(xié)作精神等)30 分個人能力水平小組實習成果質(zhì)(完成任務的數(shù)量量,個人實習報告的和質(zhì)量,實際操作質(zhì)量(內(nèi)容是否全能力,對小組實習面,結(jié)論是否正確,任務完成的

2、貢獻書寫是否規(guī)范,體會等)是否深刻等)30分40分成績等級評定指導教師評語:9010080897079606960 以下優(yōu)良中及格不及格成 績指導教師簽字:年月日一、實習目的本次數(shù)據(jù)庫課程設計是以 Access數(shù)據(jù)庫作為后臺以 C#作為前臺的應用型設計課程。綜合我們所學的兩大課程創(chuàng)建應用型的數(shù)據(jù)庫系統(tǒng),大大的提高了我們學生的動手能力,作到了理論與實踐相結(jié)合。二、實習儀器設備硬件環(huán)境 Pentium 4 以上微機,內(nèi)存 128MB 以上,建議 256MB 。操作系統(tǒng): Windows 7。編程環(huán)境: C#程序設計語言, Access2003,通過 ADO.NET 訪問。三、實習原理、內(nèi)容及步驟數(shù)

3、據(jù)庫截圖:表頁面:查詢頁面:Form1:登錄窗體Form2:學生登錄頁面Form11:教師登錄頁面修改密碼成績錄入:修改成績:四、實習中存在的問題、解決方法及進一步的想法等此次數(shù)據(jù)庫課程設計過程中,遇到的主要問題總結(jié)如下:第一:看錯誤列表,如“找不到”成績表“,后來問同學知道,是沒有找到我要的數(shù)據(jù),是我編寫錯誤了,我在數(shù)據(jù)里寫的是”成績“表。第二:立數(shù)據(jù)庫時,以為是在 access 里面建立各種窗體的,做了很多沒用工,后來看了老師給我例子,才知道是 vs 上建立各種窗體的。第三:在 C#中建立與 access 數(shù)據(jù)庫連接時,直接提供路徑,沒有連接上,而后在連接數(shù)據(jù)庫時在連接句前加上 字符相對于

4、單一的連接語句更容易連接得上。把文件和源文件放在同一個文件內(nèi),寫代碼連接時更簡單了第四:不知道怎樣建立一個主窗體,讓老師進入和學生進入能進行不同的內(nèi)容,我怎么也建立不起來,后來建立兩個主窗體,一個學生進入的主窗體,一個老師進入的主窗體。第五:每次用到數(shù)據(jù)庫時,都要建立連接,這樣要寫大量的代碼,在項目里建立一個與數(shù)據(jù)庫連接的類就,每次用到時,調(diào)用就行,五、實習心得體會通過本次課程設計,總的來說,受益菲淺,這些天中我們學到了很多東西,包括建表,導入數(shù)據(jù),查詢,插入,最重要的是我們有機會用電腦自己進行實踐,開始認為它很難,后來在實踐結(jié)合找資源,慢慢的都做出來了,遇到困難時一定不要放棄,多去找書,多去

5、向別人請教,多去實踐問題對的。在這個過程中,我對 C#建立窗體有了更深的認識,對 .net 有了了解,我還發(fā)現(xiàn),想學好這個,英語也要好才行。我以后一定好好學英語,好好學數(shù)據(jù)庫。注:此報告為參考格式,各欄項目可根據(jù)實際情況進行調(diào)整。附:源代碼Form1:登錄窗體using System;using System.Linq;using System.Text;namespaceamwclassqpublicstaticOleDbConnection con =new黃第科A.mdb");using System;using System.ComponentModel;using Syst

6、em.Data;using System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclassForm1 :FormpublicForm1()InitializeComponent();privatevoid button1_Click(objectsender,EventArgs e)DataSet dataset =new DataSet();/ 創(chuàng)建數(shù)據(jù)集/打開連接"" ) /驗證是否輸入了用戶姓名MessageBox.Show(" 用戶名不能為空 "

7、);textBox1.Focus();return ;if"" )/驗證是否輸入了密碼MessageBox.Show(" 請輸入密碼 " );textBox2.Focus();return ;if(radioButton1.Checked =true )stringOleDb ="select count(*) from密碼where用戶名 ='""' and密碼 ='"+ "'and用戶類型 =' 學生 '" ;OleDbCommandcomm

8、= new OleDbCommand(OleDb,q.con);/ 創(chuàng)建 comm對象intcount = (int )comm.ExecuteScalar();/ 執(zhí)行查詢,并返回查詢if(count = 1)/ 判斷是否存在這樣一列MessageBox.Show(" 登錄成功! " );this .Hide();Form2 f2 =new Form2();f2.Show();elseMessageBox.Show(" 不存在此用戶 " );if(radioButton2.Checked =true )stringOleDb = "selec

9、t count(*) from密碼where用戶名='""' and密碼 ='""'and用戶類型=' 老師'" ;OleDbCommandcomm = new OleDbCommand(OleDb,q.con);/ 創(chuàng)建 comm對象intcount = (int )comm.ExecuteScalar();/ 執(zhí)行查詢,并返回查詢if(count = 1)/ 判斷是否存在這樣一列MessageBox.Show(" 登錄成功! " );this .Hide();Form11

10、f2 =new Form11();f2.Show();elseMessageBox.Show(" 不存在此用戶 " );修改密碼using System;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclass修改密碼 :Formpublic修改密碼 ()InitializeComponent();privatevoid button1_Click(objectsen

11、der,EventArgs e)MessageBox.Show(" 請?zhí)顚懲暾畔ⅲ?" ," 錯誤提示 " );elsestringOleDb ="select *from密碼where用戶名 ='" +"'and密碼 ='""'" ;OleDbCommandcmd = new OleDbCommand( "" ,cmd.CommandText = OleDb;if(cmd.ExecuteScalar() =null )q.con);Mess

12、ageBox.Show(" 用戶名或密碼錯誤! " ," 錯誤提示" );elseifMessageBox.Show(" 新密碼和確認密碼不一致,請重新輸入! " ," 錯誤提示 " );elseOleDb ="update密碼 set密碼 ='" +"' where用戶名"'" ;cmd.CommandText = OleDb;cmd.ExecuteNonQuery();this .Close();MessageBox.Show("

13、; 密碼修改成功! " ," 成功提示 " );privatevoid button2_Click(objectsender,EventArgs e)this .Close();成績錄入:using System;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclass成績錄入 :Formpublic成績錄入 ()InitializeComponent();

14、privatevoid button1_Click(objectsender,EventArgs e)DataSet dataset =new DataSet();/ 創(chuàng)建數(shù)據(jù)集stringOleDbstring ="insert into成績values('"+ xh +"','"+ xm +"','"+ cn +"')"OleDbCommandoldcomm = new OleDbCommand(OleDbstring,q.con);intn = oldcomm.

15、ExecuteNonQuery();if(n = 1)MessageBox.Show(" 記錄已成功添加到表中 " );privatevoid button2_Click(objectsender,EventArgs e)this .Close();修改成績:using System;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclass成績修改 :Formpubl

16、ic成績修改 ()InitializeComponent();CurrencyManager cz;privatevoid button1_Click(objectsender,EventArgs e)cz.Position = 0;privatevoid成績修改 _Load(objectsender,EventArgs e)string CString = Source=黃第科 A.mdb"stringOleDbstring ="select * from成績"OleDbConnection MyCon = new OleDbConnection(CString

17、);/創(chuàng)建連接對象MyCon.Open();OleDbDataAdapter oda =new OleDbDataAdapter(OleDbstring,CString);DataSet dataset =new DataSet();oda.Fill(dataset," 成績" );"Text" , dataset,"成績.學號");"Text" , dataset," 成績 . 課程編號" );"Text" , dataset,"成績.成績");cz =

18、 (CurrencyManager) this .BindingContextdataset," 成績" ;cz.Position = 0;privatevoid button2_Click(objectsender,EventArgs e)if( this .cz.Position = 0)MessageBox.Show(" 已經(jīng)是第一條記錄 " ," 信息提示 " ,MessageBoxButtons.OK, MessageBoxIcon.Information); return ;elsethis .cz.Position-;p

19、rivatevoid button3_Click(objectsender,EventArgs e)if( this .cz.Position =this .cz.Count - 1)MessageBox.Show(" 已經(jīng)是末一條記錄 " ," 信息提示 " ,MessageBoxButtons.OK, MessageBoxIcon.Information); return ;elsethis .cz.Position+;成績查詢:using System;using System.ComponentModel;using System.Data;us

20、ing System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclass成績查詢 :Formpublic成績查詢 ()InitializeComponent();privatevoid成績查詢 _Load(objectsender,EventArgs e)/ TODO: 這行代碼將數(shù)據(jù)加載到表 “黃第科 ADataSet. 成績表 ” 中。您可以根據(jù)需要移動或刪除它。this . 成績表 TableAdapter.Fill(this . 黃第科 ADataSet. 成績表 );privatevoi

21、d button2_Click(objectsender,EventArgs e)stringconnstring =黃第科 A.mdb"stringSqlstring ="select學號 as學號 , 課程編號 as課程編號 , 成績 as成績 from成績表 where成績 >=60"OleDbConnection oldconn = new OleDbConnection (connstring); oldconn.Open();OleDbDataAdapter oda =new OleDbDataAdapter(Sqlstring,connstri

22、ng);DataSet ds =new DataSet ();oda.Fill(ds,"ScoreInfo");dataGridView1.DataSource = ds.Tables"ScoreInfo"stringsql ="select count(*) from成績表where成績 >=60"label1.Text =" 及格人數(shù)有 " + sql.ToString();privatevoid button4_Click(objectsender,EventArgs e)this .Close();p

23、rivatevoid button3_Click(objectsender,EventArgs e)stringconnstring =黃第科 A.mdb"stringSqlstring ="select學號 as學號 , 課程編號as課程編號,成績 as成績from成績表where成績 <60"OleDbConnection oldconn = new OleDbConnection (connstring); oldconn.Open();OleDbDataAdapter oda =new OleDbDataAdapter(Sqlstring,conns

24、tring);DataSet ds =new DataSet ();oda.Fill(ds,"ScoreInfo");dataGridView1.DataSource = ds.Tables"ScoreInfo"stringsql ="select count(*) from成績表where成績 <60"label1.Text =" 及格人數(shù)有 " + sql.ToString();privatevoid button1_Click(objectsender,EventArgs e)stringconnstr

25、ing =黃第科 A.mdb"stringSqlstring ="select學號 as學號 , 課程編號as課程編號 , 成績 as成績from成績表where學號 ='"+"'"OleDbConnection oldconn = new OleDbConnection (connstring); oldconn.Open();OleDbDataAdapter oda =new OleDbDataAdapter(Sqlstring,connstring);DataSet ds =new DataSet ();oda.Fill(

26、ds,"成績表 ");dataGridView1.DataSource = ds.Tables" 成績表 " ;學生信息查詢:using System.Linq;using System.Text;namespaceamwpublicpartialclass信息查詢 :FormCurrencyManager ca;public信息查詢 ()InitializeComponent();privatevoid信息查詢 _Load(objectsender,EventArgs e)stringconnstring =黃第科 A.mdb"strings

27、qlstring ="select * from學生信息表 " ;OleDbConnection oldconn =new OleDbConnection (connstring);oldconn.Open();OleDbDataAdapter oda =new OleDbDataAdapter(sqlstring,connstring);DataSet ds = oda.Fill(ds,new DataSet ();" 學生信息表 " );"Text" , ds," 學生信息表. 學號" );"Text

28、" , ds," 學生信息表. 姓名" );"Text" , ds," 學生信息表. 性別" );"Text" , ds," 學生信息表. 日期" );"Text" , ds," 學生信息表. 班級" );ca = (CurrencyManager) this .BindingContextds," 學生信息表" ;ca.Position = 0;privatevoid button1_Click(objectsender,E

29、ventArgs e)if(ca.Position = 0)MessageBox.Show(" 已經(jīng)是第一條記錄了 " ," 信息提示 " ,MessageBoxButtons.OK, MessageBoxIcon.Information); return ;elseca.Position = 0;privatevoid button2_Click(objectsender,EventArgs e)ca.Position-;privatevoid button3_Click(objectsender,EventArgs e)if(ca.Position

30、= ca.Count - 1)MessageBox.Show(" 已經(jīng)是最后一條記錄 " ," 信息提示 " ,MessageBoxButtons.OK, MessageBoxIcon.Information); return ;elseca.Position+;privatevoid button4_Click(objectsender,EventArgs e)ca.Position = ca.Count - 1;privatevoid button5_Click(objectsender,EventArgs e)this .Close();Form3

31、:添加學生信息頁面源代碼using System;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;namespaceWindowsFormsApplication2public partial classForm3 : Formpublic Form3()InitializeComponent();public void Form3_Load(object sender,EventArgs e) public void button2_C

32、lick(object sender,EventArgs e)public void button1_Click(object sender, EventArgs e)private void button1_Click_1(object sender,EventArgs e)MessageBox.Show("你填寫的信息不完整,請繼續(xù)填寫完整!" , "錯誤提示 ");elseOleDbCommand comm = new OleDbCommand("", C); / 創(chuàng)建comm對象string OleDb = "sel

33、ect 學號 from 學生信息表 where 學號 ='" +comm.CommandText = OleDb;if (comm.ExecuteScalar() =null )OleDb = "insert into 學生信息表comm.CommandText = OleDb;comm.ExecuteNonQuery();MessageBox.Show("學生基本信息注冊成功!", "成功信息 " );elseMessageBox.Show("你輸入的學號已經(jīng)存在,請重新輸入!", "錯誤提示

34、");private void button2_Click_1(object sender,EventArgs e)this.Close();private void Form3_Load_1(object sender,EventArgs e)DataSet dataset =new DataSet();OleDbDataAdapter adp = new OleDbDataAdapter("" , C);學號 from 學生信息表 "adp.Fill(dataset);textBox1.Focus();Form8:刪除成績頁面using System

35、;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;namespaceWindowsFormsApplication2public partial classForm8 : Formpublic Form8()InitializeComponent();private void button1_Click( object sender,EventArgs e)DataView dv = 黃第科 DataSet.成績表 .DefaultView;dv.Sort = "

36、學號 "dv.RowFilter = "學號string sqlstring = "delete from 成績表 where 學號+"'"OleDbCommand sqlcomm = new OleDbCommand(sqlstring, C); sqlcomm.ExecuteNonQuery();MessageBox.Show("刪除成功! ", "提示 ", MessageBoxButtons.OK,MessageBoxIcon.Information);private void butto

37、n2_Click(object sender,EventArgs e)private void Form8_Load(object sender,EventArgs e)/ TODO: 這行代碼將數(shù)據(jù)加載到表 “彭博管理系統(tǒng) DataSet.成績表 ”中。您可以根據(jù)需要移動或刪除它。this.成績表 TableAdapter.Fill(this.黃第科 ADataSet.成績表 );private void button2_Click_1(object sender,EventArgs e)this.Close();從 form到成績查詢,成績錄入,成績改正,添加用戶,修改密碼,信息查詢,退出

38、系,統(tǒng),重新登錄using System;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;namespaceamwpublicpartialclassForm11 :FormpublicForm11()InitializeComponent();修改密碼 a;privatevoid修改密碼 ToolStripMenuItem_Click(objectsender,EventArgs e)if(a =null| a.IsDisposed)a =new 修改密碼 ();a.Show();添加用戶 b;privatevoid添加用戶 ToolStripMenuItem_Click(objectsender,EventArgs e)if(b =null| a.IsDisposed)b =new 添加用戶 ();b.Show();privatevoid退出系統(tǒng) ToolStripMenuItem_Click(objectsender,EventArgs e)this .Close();成績錄入 c;privatevoid成績錄入 ToolStripMenuItem_Click(objectsender,EventArgs e)

溫馨提示

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

評論

0/150

提交評論