《C#程序設(shè)計(jì)》課程設(shè)計(jì)報(bào)告學(xué)生成績(jī)管理系統(tǒng)
《《C#程序設(shè)計(jì)》課程設(shè)計(jì)報(bào)告學(xué)生成績(jī)管理系統(tǒng)》由會(huì)員分享,可在線閱讀,更多相關(guān)《《C#程序設(shè)計(jì)》課程設(shè)計(jì)報(bào)告學(xué)生成績(jī)管理系統(tǒng)(26頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、C#程序設(shè)計(jì)課程設(shè)計(jì)報(bào)告(2010 2011學(xué)年 第 2 學(xué)期)題 目: 專 業(yè): 班 級(jí): 姓名學(xué)號(hào): 指導(dǎo)教師: 成 績(jī): 計(jì)算機(jī)科學(xué)與技術(shù)系年月日C#學(xué)生成績(jī)管理系統(tǒng)一、設(shè)計(jì)目的1、掌握簡(jiǎn)單WinForm應(yīng)用程序的設(shè)計(jì)2、ADO.net的應(yīng)用。3、使用C#語(yǔ)言解決實(shí)際問(wèn)題的能力二、設(shè)計(jì)內(nèi)容1、基本要求 (1)根據(jù)查詢條件實(shí)現(xiàn)學(xué)生信息的查詢。 (2)學(xué)生選課信息查詢、成績(jī)信息的查詢。 (3)學(xué)生信息、課程信息、成績(jī)信息的增加、刪除、修改。 (4)對(duì)基本信息完成增加、刪除、修改時(shí),需注意表與表之間的關(guān)聯(lián)三、軟件設(shè)計(jì)過(guò)程 一、按照任務(wù)書(shū)寫(xiě)表格1、 課程表2、 學(xué)生表3、 成績(jī)表另外添加了一張用
2、戶登陸表2、 軟件功能介紹1、登陸界面 點(diǎn)擊登陸后進(jìn)入主界面,點(diǎn)擊退出即退出系統(tǒng)2、 主界面主界面有四個(gè)按鈕,分別是:學(xué)生信息查尋、學(xué)生信息修改、學(xué)生成績(jī)錄入和退出。前三個(gè)進(jìn)入相應(yīng)的功能界面,退出則是退出系統(tǒng)。3、 學(xué)生信息查詢界面進(jìn)入學(xué)生信息查尋界面??梢园凑招彰?、學(xué)號(hào)和專業(yè)進(jìn)行查尋。按專業(yè)查詢:按姓名查詢:按學(xué)號(hào)查詢:點(diǎn)擊會(huì)顯示所選行學(xué)生的成績(jī) 以學(xué)號(hào)061101王林為例:返回鍵返回主菜單4、學(xué)生信息修改界面點(diǎn)擊任意一行,會(huì)將相應(yīng)學(xué)生的信息顯示在分別顯示在相應(yīng)的空格里,如圖:對(duì)其作出修改點(diǎn)擊更新當(dāng)輸入的姓名在學(xué)生表里沒(méi)有時(shí),如:點(diǎn)擊更新怎是加入一條學(xué)生信息選中一條學(xué)生信息,點(diǎn)擊刪除,會(huì)有提
3、示框提示是否刪除:點(diǎn)擊確定會(huì)提示刪除成功取消則是取消刪除。返回鍵返回主菜單5、 學(xué)生成績(jī)錄入界面進(jìn)入學(xué)生成績(jī)錄入界面,顯示有記錄學(xué)生成績(jī)的學(xué)號(hào)、姓名、課程號(hào)及成績(jī)。錄入成績(jī),以錄入Tom 學(xué)號(hào)061120課程號(hào)101為例:點(diǎn)擊確認(rèn)即錄入成績(jī)點(diǎn)擊返回,返回主菜單。四、心得體會(huì) 這次課程設(shè)計(jì),一開(kāi)始無(wú)從下手。在聽(tīng)過(guò)老師的講解后,逐漸知道了大體方向。開(kāi)始慢慢地做了起來(lái)。碰到困難,尋求同學(xué)和網(wǎng)絡(luò)的幫助,在他們的幫助下,問(wèn)題一一解決,最終完成了此次的課程設(shè)計(jì)。此次的課程設(shè)計(jì)讓我對(duì)C#和數(shù)據(jù)庫(kù)有更深一步的了解,把平時(shí)零散的理論知識(shí)在此次課程設(shè)計(jì)中用起來(lái)了。同時(shí)也發(fā)現(xiàn)了自己的不足之處,日后要多多實(shí)踐。五、源
4、程序 用戶登陸界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace _1 public partial class userLog : Form public userLog() InitializeComponent()
5、; public string connstr; public void Getway() connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; private void quit_Click(object sender, EventArgs e) this.Close(); private void log_Click(object sender, EventArgs e) Getway
6、(); string username = uname.Text.Trim(); string password = upassword.Text.Trim(); /string selectcommond = select * from Userxx where UserName =+ username+ and Userpassword = + password+; string _sql = select * from userinfo; /方?便?前期操作痢? 后來(lái)?要癮刪?除y的?記?住? using (SqlConnection conn = new SqlConnection(c
7、onnstr) conn.Open(); SqlCommand sql = new SqlCommand(_sql, conn); SqlDataReader reader = sql.ExecuteReader(); if (reader.Read() main open1 = new main(); open1.ShowDialog(); else if (uname.Text = ) MessageBox.Show(用?戶名?不?能為a空?!?, 錯(cuò)洙?誤提?示?!?); else if (upassword.Text = ) MessageBox.Show(密碼?不?能為a空?!?,
8、錯(cuò)洙?誤提?示?!?); else MessageBox.Show(不?存?在該?用?戶信?息!?, 錯(cuò)洙?誤提?示?!?); uname.Text = ; upassword.Text = ; 主界面 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlC
9、lient;namespace _1 public partial class main : Form public main() InitializeComponent(); private void button1_Click_1(object sender, EventArgs e) StuinfoCheck stu1 = new StuinfoCheck(); stu1.ShowDialog(); private void button2_Click_1(object sender, EventArgs e) StuinfoAdd stu2 = new StuinfoAdd(); st
10、u2.ShowDialog(); private void button3_Click_1(object sender, EventArgs e) StuGraceinfo stu3 = new StuGraceinfo(); stu3.ShowDialog(); private void button4_Click_1(object sender, EventArgs e) this.Close(); 學(xué)生信息查詢using System;using System.Collections.Generic;using System.ComponentModel;using System.Dat
11、a;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;using System.IO;namespace _1 public partial class StuinfoCheck : Form public StuinfoCheck() InitializeComponent(); public string SelectSno; private void StuinfoCheck_Load(object sender,
12、EventArgs e) / TODO: 這a行D代洙?碼?將?數(shù)簓據(jù)Y加載?到?表括?“studentDataSet.S”中D。您可以?根據(jù)Y需要癮移?動(dòng)或移?除y它。 /this.sTableAdapter.Fill(this.studentDataSet.S); / TODO: 這a行D代洙?碼?將?數(shù)簓據(jù)Y加載?到?表括?“studentDataSet.C”中D。您可以?根據(jù)Y需要癮移?動(dòng)或移?除y它。 /this.cTableAdapter.Fill(this.studentDataSet.C); /- string connstr = Data Source=.SQLEXPRESS
13、;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _sql = SELECT Sno as 學(xué)號(hào)?,Sname as 姓?名?,Smajor as 專痢?業(yè)唉?Ssex as 性?別纄,Sbirth as 生?日?,totalpoint as 總哩?學(xué)分?,remark as 備?注痢?from S; / string _sql = select Sno as 學(xué)號(hào)?,Sname as 姓?名? from S; SqlConnectio
14、n cnn = new SqlConnection(connstr); SqlDataAdapter sda = new SqlDataAdapter(_sql, cnn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables0.DefaultView; string sql_Smajor=select distinct Smajor from S; SqlCommand cmd = new SqlCommand(sql_Smajor,cnn); cnn.Open(); / SqlData
15、Reader dr = new SqlDataReader(); SqlDataReader dr = cmd.ExecuteReader(); while(dr.Read() majorSelection.Items.Add(dr0); cnn.Close(); majorSelection.SelectedIndex=0; public DataSet Conn(string sql) string connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Conne
16、ct Timeout=30;User Instance=False; /string _sql = SELECT Sno as 學(xué)號(hào)?,Sname as 姓?名?,Smajor as 專痢?業(yè)唉?Ssex as 性?別纄,Sbirth as 生?日?,totalpoint as 總哩?學(xué)分?,remark as 備?注痢?from S; SqlConnection cnn = new SqlConnection(connstr); SqlDataAdapter sda = new SqlDataAdapter(sql, cnn); DataSet ds = new DataSet(); sda
17、.Fill(ds); return ds ; private void search_Click(object sender, EventArgs e) string sql = select * from S where 1=1 ; if (no.Text.Trim() != string.Empty) sql += and Sno like % + no.Text.Trim() + %; if (name.Text.Trim() != string.Empty) sql += and Sname like % + name.Text.Trim() + %; if (majorSelecti
18、on.Text.Trim() != 所有瓺專痢?業(yè)唉?) sql += and Smajor like % + majorSelection.Text + ; DataSet ds = Conn(sql); dataGridView1.DataSource = ds.Tables0.DefaultView; /private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) / / string str = dataGridView1.CurrentRow.
19、Cells0.Value.ToString(); / string _sql = SELECT Sno as 學(xué)號(hào)?,Sname as 姓?名?,Smajor as 專痢?業(yè)唉?Ssex as 性?別纄,Sbirth as 生?日?,totalpoint as 總哩?學(xué)分?,remark as 備?注痢?from S; / DataSet ds = Conn(_sql); / dataGridView1.DataSource = ds.Tables0.DefaultView; / private void dataGridView1_RowHeaderMouseClick(object sen
20、der, DataGridViewCellMouseEventArgs e) stuinfodetail formCourse = new stuinfodetail(); formCourse.SelectSno = dataGridView1.CurrentRow.Cells0.Value.ToString(); formCourse.ShowDialog(); private void exit_Click(object sender, EventArgs e) this.Close(); 成績(jī)顯示界面using System;using System.Collections.Gener
21、ic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace _1 public partial class stuinfodetail : Form public string SelectSno; public stuinfodetail() InitializeComponent(); private void
22、stuinfodetail_Load(object sender, EventArgs e) string connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _sql = SELECT S.Sno as 學(xué)號(hào)?,Sname as 姓?名?,Cno as 課?程號(hào)?,Point 成績(jī) FROM S,SC where S.Sno = SC.Sno and S.Sno= + t
23、his.SelectSno + ; SqlConnection cnn = new SqlConnection(connstr); cnn.Open(); SqlDataAdapter sda = new SqlDataAdapter(_sql, cnn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables0.DefaultView; cnn.Close(); 學(xué)生信息修改using System;using System.Collections.Generic;using System
24、.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace _1 public partial class StuinfoAdd : Form public StuinfoAdd() InitializeComponent(); private void StuinfoAdd_Load(object sender, EventArgs e) /
25、TODO: 這a行D代洙?碼?將?數(shù)簓據(jù)Y加載?到?表括?“studentDataSet.S”中D。您可以?根據(jù)Y需要癮移?動(dòng)或移?除y它。 /this.sTableAdapter.Fill(this.studentDataSet.S); / TODO: 這a行D代洙?碼?將?數(shù)簓據(jù)Y加載?到?表括?“studentDataSet.C”中D。您可以?根據(jù)Y需要癮移?動(dòng)或移?除y它。 /this.cTableAdapter.Fill(this.studentDataSet.C); /- string connstr = Data Source=.SQLEXPRESS;AttachDbFilena
26、me=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _sql = SELECT Sno as 學(xué)號(hào)?,Sname as 姓?名?,Smajor as 專痢?業(yè)唉?Ssex as 性?別纄,Sbirth as 生?日?,totalpoint as 總哩?學(xué)分?,remark as 備?注痢?from S; / string _sql = select Sno as 學(xué)號(hào)?,Sname as 姓?名? from S; SqlConnection cnn = new Sql
27、Connection(connstr); SqlDataAdapter sda = new SqlDataAdapter(_sql, cnn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables0.DefaultView; /string sql_Smajor = select distinct Smajor from S; /SqlCommand cmd = new SqlCommand(sql_Smajor, cnn); cnn.Open(); /SqlDataReader dr =
28、 new SqlDataReader(); /SqlDataReader dr = cmd.ExecuteReader(); /while (dr.Read() / / majorSeletion.Items.Add(dr0); / /cnn.Close(); /majorSeletion.SelectedIndex = 0; private void delete_Click(object sender, EventArgs e) string connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrat
29、ed Security=True;Connect Timeout=30;User Instance=False; DialogResult ret = MessageBox.Show(確?定要癮刪?除y該?信?息嗎e??, 刪?除y, MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if(ret = DialogResult.Cancel) return; string _sql=delete from S where Sno=+stuno.Text+; SqlConnection conn = new SqlConnectio
30、n(connstr); SqlCommand cmd = new SqlCommand(_sql,conn); try conn .Open(); int rows=cmd .ExecuteNonQuery(); if(rows = 1) MessageBox.Show(刪?除y成功|!?, 提?示?, MessageBoxButtons.OK, MessageBoxIcon.Information); StuinfoAdd_Load(null ,null ); finally conn.Close(); private void dataGridView1_RowHeaderMouseCli
31、ck(object sender, DataGridViewCellMouseEventArgs e) stuno.Text = dataGridView1.CurrentRow.Cells0.Value.ToString(); stuname.Text = dataGridView1.CurrentRow.Cells1.Value.ToString(); cname.Text = dataGridView1.CurrentRow.Cells2.Value.ToString(); stubirth.Text = dataGridView1.CurrentRow.Cells4.Value.ToS
32、tring(); credit.Text = dataGridView1.CurrentRow.Cells5.Value.ToString(); sturemark.Text = dataGridView1.CurrentRow.Cells6.Value.ToString(); if (dataGridView1.CurrentRow.Cells3.Value.ToString().Trim () = 男D) male.Checked = true; else female.Checked = true; /stubirth.Text = Convert.ToDateTime(stubirth
33、.Text.Trim().ToShortDateString(); private void updata_Click(object sender, EventArgs e) /更新?信?息 string connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _title = select count(*) from S where sno= + stuno.Text + ;
34、 SqlConnection conn = new SqlConnection(connstr); SqlCommand cmd = new SqlCommand(_title, conn); /檢查是?否?有瓺該?學(xué)生?的?信?息,?有瓺則修T改?,?無(wú)T則添?加 try conn.Open(); int str = (int)cmd.ExecuteScalar();/強(qiáng)?制?轉(zhuǎn)羇換?,?執(zhí)行D查詢并返?回?查詢所返?回?的?結(jié)果?集中D第臺(tái)?一?行D的?第臺(tái)?一?列 /修T改?信?息 if (str = 1) _title = update S set Sname = + stuname.
35、Text + ,Smajor = + cname.Text + ,totalpoint = + int.Parse(credit.Text) + ,remark= + sturemark.Text + where Sno= + stuno.Text + ; /添?加新?信?息 else /DateTime cn = Convert.ToDateTime(stubirth.Text.Trim(); string sex = male.Checked ? 男D : 女?; _title = insert into S(Sno,Sname,Smajor,Ssex,Sbirth,totalpoint,
36、remark) values ( + stuno.Text + , + stuname.Text + , + cname.Text + , + sex + , + stubirth.Text.Trim() + , + int.Parse(credit.Text) + , + sturemark.Text + ); cmd = new SqlCommand(_title, conn); cmd.ExecuteNonQuery(); StuinfoAdd_Load(null, null); finally conn.Close(); private void exit_Click(object s
37、ender, EventArgs e) this.Close(); 學(xué)生成績(jī)錄入using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace _1 public partial class StuGraceinfo : Form pu
38、blic StuGraceinfo() InitializeComponent(); private void StuGraceinfo_Load(object sender, EventArgs e) string connstr = Data Source=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _sql = SELECT S.Sno as 學(xué)號(hào)?,Sname as 姓?名?,Cno as 課?程號(hào)?
39、,Point as 成績(jī) FROM S,SC where S.Sno=SC.Sno; /SELECT Sno as 學(xué)號(hào)?,Sname as 姓?名?,Smajor as 專痢?業(yè)唉?Ssex as 性?別纄,Sbirth as 生?日?,totalpoint as 總哩?學(xué)分?,remark as 備?注痢?from S SqlConnection cnn = new SqlConnection(connstr); SqlDataAdapter sda = new SqlDataAdapter(_sql, cnn); cnn.Open(); DataSet ds = new DataSet(
40、); sda.Fill(ds); dataGridView1.DataSource = ds.Tables0.DefaultView; /cnn.Close(); private void button3_Click(object sender, EventArgs e) this.Close(); private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) textBox1.Text = dataGridView1.CurrentRow.Cells1
41、.Value.ToString(); textBox3.Text = dataGridView1.CurrentRow.Cells0.Value.ToString(); textBox4.Text = dataGridView1.CurrentRow.Cells3.Value.ToString(); textBox6.Text = dataGridView1.CurrentRow.Cells2.Value.ToString(); private void button1_Click(object sender, EventArgs e) string connstr = Data Source
42、=.SQLEXPRESS;AttachDbFilename=E:1Student.mdf;Integrated Security=True;Connect Timeout=30;User Instance=False; string _sql = select count(*) from S where S.Sno= + textBox1.Text + ; string sql1 = select Cno from C where Cno= + textBox6 .Text + ; SqlConnection cnn = new SqlConnection(connstr); SqlComma
43、nd cmd = new SqlCommand(_sql,cnn); SqlCommand cmd1 = new SqlCommand(sql1, cnn); string cno=; try cnn.Open(); SqlDataReader dr = cmd1.ExecuteReader(); while (dr.Read() cno = dr0.ToString(); cnn.Close(); cnn.Open(); int cnt = (int)cmd.ExecuteScalar(); /制?轉(zhuǎn)羇化 返?回?第臺(tái)?一?行D第臺(tái)?一?列 修T改?記?錄? if (cnt = 1) _sq
44、l = update SC set Point= + textBox4.Text + ,Cno= + textBox6.Text + where Sno=+textBox1.Text +; else /添?加記?錄? _sql = insert into SC(Sno,Cno,Point) values( + textBox3.Text.Trim() + , + textBox6.Text.Trim() + , + int.Parse(textBox4.Text.Trim() + ); cmd = new SqlCommand(_sql, cnn); int i = cmd.ExecuteNonQuery(); StuGraceinfo_Load(null, null); finally cnn.Close(); 設(shè)計(jì)日志記錄每天的主要設(shè)計(jì)內(nèi)容、遇到的問(wèn)題、解決方法及效果,等。DAY 1聽(tīng)了老師對(duì)系統(tǒng)架構(gòu)的部分分析,對(duì)本次課程設(shè)計(jì)有了大致的了解,明確了大體框架,把任務(wù)書(shū)上的數(shù)據(jù)庫(kù)表準(zhǔn)備好了,并簡(jiǎn)單地完成了系統(tǒng)各個(gè)窗體的設(shè)計(jì)。DAY 2對(duì)各個(gè)窗體進(jìn)行了更為細(xì)致的設(shè)計(jì),對(duì)需要用到的事件和要修改的屬性進(jìn)行適當(dāng)分配,以便設(shè)計(jì)代碼時(shí)能對(duì)整體更清晰,完成了用戶登陸的代碼設(shè)計(jì)。DAY 3開(kāi)始代碼設(shè)計(jì),實(shí)現(xiàn)了學(xué)生信息查詢的功能。在這過(guò)程中,遇到了許多問(wèn)題諸如數(shù)據(jù)庫(kù)的
- 溫馨提示:
1: 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- (精品)1.7有理數(shù)的混合運(yùn)算 (3)
- 管理的基本原理課件
- 第六講___朋輩心理輔導(dǎo)基本技能__理性情緒療法
- 骨科康復(fù)(全科)課件
- 年終總結(jié)及年工作計(jì)劃
- 第九章裝飾工程預(yù)算定額項(xiàng)目換算
- 魅力之城項(xiàng)目匯報(bào)方案
- 美心內(nèi)門(mén)品牌建設(shè)規(guī)劃教材
- 競(jìng)爭(zhēng)法概述
- 競(jìng)價(jià)產(chǎn)品-網(wǎng)絡(luò)營(yíng)銷(xiāo)--搜索競(jìng)價(jià)產(chǎn)品介紹(ppt 37頁(yè))
- (精品)1.5二次函數(shù)的應(yīng)用 (2)
- (精品)1.4美妙的守恒定律
- 4 放射性的應(yīng)用與防護(hù) (6)
- 第四課城鄉(xiāng)直通車(chē) (2)
- (精品)《學(xué)會(huì)看病》(精品)