學(xué)籍管理系統(tǒng)實驗報告(C#語言)_第1頁
學(xué)籍管理系統(tǒng)實驗報告(C#語言)_第2頁
學(xué)籍管理系統(tǒng)實驗報告(C#語言)_第3頁
學(xué)籍管理系統(tǒng)實驗報告(C#語言)_第4頁
學(xué)籍管理系統(tǒng)實驗報告(C#語言)_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、本科學(xué)生設(shè)計性實驗報告項目組長 張茜夢 學(xué)號 0063603 成 員 張茜夢 俞伯龍 陳健 熊維娜 專 業(yè) 軟件工程 班級 06軟件1班 實驗項目名稱 學(xué)籍管理系統(tǒng) 指導(dǎo)教師及職稱萬本庭 博士 開課學(xué)期 2008 至2009 學(xué)年 一學(xué)期上課時間 2008 年 11 月 17 日一、實驗設(shè)計方案實驗名稱:學(xué)籍管理系統(tǒng)實驗時間:2008.11.17小組合作: 是 否小組成員:張茜夢 俞伯龍 陳健 熊維娜 1、 實驗?zāi)康模壕帉懸粋€學(xué)籍管理系統(tǒng),實現(xiàn)學(xué)生基本信息的管理。2、 實驗場地及儀器、設(shè)備和材料:實驗地點(diǎn):s203儀器、設(shè)備:電腦, C#語言編程環(huán)境(vs2005)3、 實驗思路(實驗內(nèi)容、數(shù)

2、據(jù)處理方法及實驗步驟等):本次實驗是實現(xiàn)一個學(xué)生學(xué)籍管理系統(tǒng),系統(tǒng)有基本的增,刪,查,改得功能。查詢功能主要是DataSet訪問數(shù)據(jù)的功能來查找到想要獲得的學(xué)生相關(guān)信息,查找完成后再運(yùn)用其刪除數(shù)據(jù)功能將查找結(jié)果刪除。界面上基本上是由gridview來顯示數(shù)據(jù)。通過添加數(shù)據(jù)源來和數(shù)據(jù)的Student表來連接,而后運(yùn)用該控件的自帶功能來完成編輯工作。指導(dǎo)老師對實驗設(shè)計方案的意見: 該實驗步驟正確、詳盡。程序設(shè)計合理,。實驗總結(jié)全面、準(zhǔn)確,實驗分析深刻。雖然可以完成任務(wù)但是都做到這個層次上來應(yīng)該加上POP3 接收信件,可以使改城功能更加強(qiáng)大,更能深入了解郵件的傳送協(xié)議的原理。 指導(dǎo)老師簽名:萬本庭

3、2008 年 12 月 29 日 二、實驗結(jié)果與分析1、實驗?zāi)康?、場地及儀器、設(shè)備和材料、實驗思路等見實驗設(shè)計方案2、實驗現(xiàn)象、數(shù)據(jù)及結(jié)果(1).打開sql2005,新建數(shù)據(jù)庫a,新建一個表“學(xué)籍”。(2). 新建一個Windows應(yīng)用程序, 建立表(3).給各個表添加相應(yīng)代碼如下: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms

4、;namespace WindowsApplication1 public partial class Form1 : Form public Form1() InitializeComponent(); private void buttonLogin_Click(object sender, EventArgs e) if (textBoxUser.Text.Trim() = | textBoxPassword.Text.Trim() = ) MessageBox.Show(Please input uesrname and password, 錯誤提示); else if (textBo

5、xUser.Text.Trim() = admin | textBoxPassword.Text.Trim() = admin) Form3 f3 = new Form3(); f3.Show(); this.Hide(); else MessageBox.Show(Wrong user or password, 登錄失敗); private void buttonCancel_Click(object sender, EventArgs e) textBoxPassword.Text = ; textBoxUser.Text = ; private void Form1_Load(objec

6、t sender, EventArgs e) private void ButtonForm1Exit_Click(object sender, EventArgs e) this.Close(); #region Using Directivesusing System;using System.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Wind

7、ows.Forms;#endregionnamespace WindowsApplication1 public partial class Form3 : Form public Form3() InitializeComponent(); private void exitToolStripMenuItem_Click(object sender, EventArgs e) this.Close(); private void aboutToolStripMenuItem_Click(object sender, EventArgs e) Form4 f4 = new Form4(); f

8、4.Show(); private void Form3_Load(object sender, EventArgs e) private void readToolStripMenuItem_Click(object sender, EventArgs e) string output; SqlConnection thisConnection = new SqlConnection(Server = (local)sqlexpress;Integrated Security=sspi; + Database =a); SqlDataAdapter thisAdapter = new Sql

9、DataAdapter(SELECT * from 學(xué)籍, thisConnection); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, 學(xué)生); this.textBox1.Text = StuNo + tt + StuName + tt + Address + tt + ID + tt+Phone+rn; foreach (DataRow therow in thisDataSet.Tables學(xué)生.Rows) output = therowStuNo + t + therowStuName + t

10、+ therowAddress + t + therowID+t+therowPhone + rn; this.textBox1.Text += output; thisConnection .Close (); Console .Write(program finished,press enter/return to continue:); Console .ReadLine (); private void addToolStripMenuItem_Click(object sender, EventArgs e) ADD add = new ADD(); add.Show(); priv

11、ate void deleteToolStripMenuItem_Click(object sender, EventArgs e) DELETE delete = new DELETE(); delete.Show(); private void searchToolStripMenuItem_Click(object sender, EventArgs e) SEARCH search = new SEARCH(); search.Show(); private void alterToolStripMenuItem_Click(object sender, EventArgs e) AL

12、TER alter = new ALTER(); alter.Show(); #region Using Directivesusing System;using System.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;#endregionnamespace WindowsApplication1 public part

13、ial class ADD : Form public ADD() InitializeComponent(); private void buttonAddOK_Click(object sender, EventArgs e) string a, b, c, d,f; a = this.textBoxAddStuNo .Text; b = this.textBoxAddStuName .Text; c = this.textBoxAddAddress .Text; d = this.textBoxAddID .Text ; f = this.textBoxAddPhone.Text; if

14、 (textBoxAddStuNo.Text.Trim() = | textBoxAddStuName.Text.Trim() = | textBoxAddID.Text.Trim() = | textBoxAddAddress.Text.Trim() = | textBoxAddPhone.Text.Trim() = ) MessageBox.Show(please complete the information); else SqlConnection thisConnection = new SqlConnection(Server=00b758efb68a400;Integrated

15、 Security=sspi; + Database=a); SqlDataAdapter thisAdapter = new SqlDataAdapter(SELECT StuNo,StuName,Address,ID,Phone from 學(xué)籍, thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, 學(xué)籍); DataColumn keys =

16、 new DataColumn1; keys0 = thisDataSet.Tables學(xué)籍.ColumnsStuNo; thisDataSet.Tables學(xué)籍.PrimaryKey = keys; DataRow findRow = thisDataSet.Tables學(xué)籍.Rows.Find(a); if (findRow = null) DataRow thisRow = thisDataSet.Tables學(xué)籍.NewRow(); thisRowStuNo = a; thisRowStuName = b; thisRowAddress = c; thisRowId = d; this

17、Row Phone=f ; thisDataSet.Tables學(xué)籍.Rows.Add(thisRow); if (findRow = thisDataSet.Tables學(xué)籍.Rows.Find(a) != null) MessageBox .Show (Information added); /Form7 form7 = new Form7(); /form7.Show(); /output = 數(shù)據(jù)插入成功: + rn + StuNo: + this.textBox1.Text + rn + StuName: + /this.textBox2.Text + rn + Address: +

18、 this.textBox3.Text + rn + ID: + /this.textBox4.Text + rn+ID: + this.textBox4.Phone + rn; /textBox5.Text = output; else MessageBox .Show (該學(xué)號已有,請重新輸入); thisAdapter.Update(thisDataSet, 學(xué)籍); thisConnection.Close(); private void buttonAddExit_Click(object sender, EventArgs e) this.Close(); private void

19、 buttonAddClear_Click(object sender, EventArgs e) textBoxAddStuNo.Text = ; textBoxAddStuName.Text = ; textBoxAddID.Text = ; textBoxAddAddress.Text = ; textBoxAddPhone.Text = ; private void ADD_Load(object sender, EventArgs e) #region Using Directivesusing System;using System.Data.SqlClient;using Sys

20、tem.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;#endregionnamespace WindowsApplication1 public partial class DELETE : Form string a; public DELETE() InitializeComponent(); private void but

21、ton1_Click(object sender, EventArgs e) a = textBox1.Text; SqlConnection thisConnection = new SqlConnection(Server=00B758EFB68A400;Integrated Security=sspi; + Database=a); SqlDataAdapter thisAdapter = new SqlDataAdapter(SELECT * from 學(xué)籍, thisConnection); SqlCommandBuilder thisBuilder = new SqlCommand

22、Builder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, 學(xué)籍); DataColumn keys = new DataColumn1; keys0 = thisDataSet.Tables學(xué)籍.ColumnsStuNo; thisDataSet.Tables學(xué)籍.PrimaryKey = keys; DataRow findRow = thisDataSet.Tables學(xué)籍.Rows.Find(textBox1 .Text ); if (findRow !=null )

23、findRow.Delete(); thisAdapter.Update(thisDataSet, 學(xué)籍); MessageBox.Show(Information deleted); thisConnection.Close(); private void buttonWarningDCancel_Click(object sender, EventArgs e) this.Close(); private void DELETE_Load(object sender, EventArgs e) private void ButtonFormDeleteEnter_Click(object

24、sender, EventArgs e) string output; SqlConnection thisConnection = new SqlConnection(Server =00b758efb68a400;Integrated Security=sspi; + Database =a); SqlDataAdapter thisAdapter = new SqlDataAdapter(SELECT * from 學(xué)籍, thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter)

25、; DataSet thisDataSet = new DataSet(); thisAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; thisAdapter.Fill(thisDataSet ,學(xué)籍); DataRow findRow = thisDataSet.Tables學(xué)籍.Rows.Find(textBox1.Text); output = StuNo + tt + findRowStuNo + rn + rn + StuName + tt + findRowStuName + rn + rn + Addres

26、s + tt + findRowAddress + rn + rn + ID + tt + findRowID + rn + rn + Phone + tt + findRowPhone + rn ; this.textBox3.Text += output; thisConnection.Close(); #region Using Directivesusing System;using System.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using System.Data;u

27、sing System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;#endregionnamespace WindowsApplication1 public partial class SEARCH : Form /string output; public SEARCH() InitializeComponent(); private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) private v

28、oid d(object sender, EventArgs e) private void SEARCH_Load(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) try catch(DataException ex) MessageBox.Show(ex.Message.ToString(); private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) pri

29、vate void button1_Click_1(object sender, EventArgs e) Search_by_StuNo no=new Search_by_StuNo() ; no.Show(); this.Hide(); private void button2_Click(object sender, EventArgs e) Search_by_StuName name = new Search_by_StuName(); name.Show(); this.Hide(); #region Using Directivesusing System;using Syste

30、m.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;#endregionnamespace WindowsApplication1 public partial class Search_by_StuName : Form public Search_by_StuName() InitializeComponent(); pr

31、ivate void button1_Click(object sender, EventArgs e) string output=; if (textBox2.Text = null) MessageBox.Show(Please input the StuName); else SqlConnection thisConnection = new SqlConnection(Server =00b758efb68a400;Integrated Security=sspi; + Database =a); SqlDataAdapter thisAdapter = new SqlDataAd

32、apter(select * from 學(xué)籍 where StuName like % + textBox2.Text.ToString() + %, thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; thisAdapter.Fill(thisDataSet, 學(xué)籍); D

33、ataRow findRow = thisDataSet.Tables學(xué)籍.Rows.Find(textBox2.Text); if (findRow = null) MessageBox.Show(ERROR:Nonexistent StuName!); textBox1.Text = ; else output = StuNo + tt + findRowStuNo + rn + rn + StuName + tt + findRowStuName + rn + rn + Address + tt + findRowAddress + rn + rn + ID + tt + findRow

34、ID + rn + rn + Phone + tt + findRowPhone + rn; this.textBox1.Text += output; thisConnection.Close(); private void Search_by_StuName_Load(object sender, EventArgs e) #region Using Directivesusing System;using System.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using Sys

35、tem.Data;using System.Drawing;using System.Text;using System.Windows.Forms;#endregionnamespace WindowsApplication1 public partial class Search_by_StuNo : Form public Search_by_StuNo() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string output; if (textBox1.Text = nul

36、l) MessageBox.Show(Please input the StuNo); else SqlConnection thisConnection = new SqlConnection(Server =00b758efb68a400;Integrated Security=sspi; + Database =a); SqlDataAdapter thisAdapter = new SqlDataAdapter(SELECT * from 學(xué)籍, thisConnection); SqlCommandBuilder thisBuilder = new SqlCommandBuilder

37、(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; thisAdapter.Fill(thisDataSet, 學(xué)籍); DataRow findRow = thisDataSet.Tables學(xué)籍.Rows.Find(textBox1.Text); if (findRow = null) MessageBox.Show(ERROR:Nonexistent StuNo!); textBox1.Text = ; e

38、lse output = StuNo + tt + findRowStuNo + rn + rn + StuName + tt + findRowStuName + rn + rn + Address + tt + findRowAddress + rn + rn + ID + tt + findRowID + rn + rn + Phone + tt + findRowPhone + rn; this.textBox2.Text += output; thisConnection.Close(); private void Search_by_StuNo_Load(object sender

39、, EventArgs e) #region Using Directivesusing System;using System.Data.SqlClient;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.OleDb;#endregionnamespace WindowsApplication1 public partial class ALTER : Form string output1, output2, output3, output4; /string a, b, c, d, f; public ALTER() InitializeComponent(); private void buttonAddClear_Click(object sender, EventArgs e) SqlConnection thisConnection = new SqlConnection(Server =00b758efb68

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論