




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、精選優質文檔-傾情為你奉上精選優質文檔-傾情為你奉上專心-專注-專業專心-專注-專業精選優質文檔-傾情為你奉上專心-專注-專業一需求分析1.1設計任務本設計的任務是學生選課系統的設計與實現,其中要實現,課程信息管理(錄入、查詢、維護);學生信息管理(錄入、查詢、維護);教師信息管理(錄入、查詢、維護);選課管理(選課、退課、選課信息查詢);教師輸入成績管理(查詢學生選的課并給學生成績)。1.2 系統性能需求實用性:為學生選課提供方便,可以有效的管理學生選課。先進性:產品的系統設計和開發應緊跟著整個計算機發展潮流,采用當時最先進的設計思想,利用最新的開發技術和開發工具。使系統能夠無論在功能設計上
2、,還是在技術實現上,都處于同行業的領先地位。操作簡單:本系統應該適用于不同水平的使用者,同時系統不應太復雜和煩瑣,因此要求系統的操作盡可能簡單易行。適應性:應該能廣泛應用于不同類型的大、中、小學院校,系統采用模塊化設計,用戶可以根據自己的實際情況自行組合,使系統在不同的硬件環境下都能得以應用。 代碼可讀性好:文中的代碼將盡可能簡潔,易懂。1.3可行性分析經濟可行性:由于本系統的主要背景是課程設計,不注重直接的經濟效益和其后的發展方向,只在注重自身水平和能力的提高,對自身的經濟要求也不高,只要有一臺能運Microsoft Visual Studio 2008軟件的電腦便可,所以不用考慮到經濟問題
3、。技術可行性: 本系統的開發使用數據庫,只需考慮安裝SQL sever數據庫的問題,在技術上要求并不高,因此本系統在技術上是可行的。運行可行性: 本系統是一個學生選課系統,所耗費的資源非常的小,現在一般的電腦無論是硬件還是軟件都能夠滿足條件,因此,本系統在運行上是可行的。綜上所述,本系統的設計與開發在技術上和硬件設備上的條件都是滿足的,因此,它在技術上是可行的。二數據庫設計21實體關系圖學號性別學生表班級出生日期期期姓名 圖2.11 學生實體關系圖 教師表所在系所授課程教師名教師編號圖2.12 教師實體關系圖課程名稱學分課程表開課系課程編號任課老師圖2.13 課程實體關系圖教師編號課程名稱學分
4、選課表教師姓名課程編號成績名班級學號姓名圖2.14 選課實體關系圖2.2 數據字典 數據項是數據庫的關系中不可再分的數據單位,下表分別列出了數據的名稱、數據類型、長度、取值能否為空。利用SQL Server 2000建立“學生選課”數據庫,其基本表清單及表結構描述如下:表2.1 數據庫中用到的表:數據庫表名關系模式名稱備注Student學生表學生基本信息表Course課程表課程基本信息表Teach教師表教師基本信息Stu_Cour選課表學生選課信息 表2.2 Student基本情況數據表:字段名字段類型Not Null說明SnoCharPrimary key學號SnamecharNot Nul
5、l姓名Sclasschar班級Sageintr出生日期Ssexchar性別表2.3Teach基本情況數據表:字段名字段類型Not Null說明TnoCharPrimary key教師編號TnamecharNot Null教師名Cnochar外部碼所授課程Tdeptchar所在系表2.4Course數據表:字段名字段類型約束控制說明Cnochar主鍵(primary key)課程號Cnamecharnot null課程名稱Ctimeint課時Ccreditint學分Cteachenchar任課老師表2.5Stu_cour情況數據表:字段名字段類型約束控制說明Cnochar外部鍵課程編號Snoch
6、ar外部鍵學號Snamechar姓名Sclasschar班級SCgradechar成績Tnamechar教師名Tnochar教師編號Cnamechar課程名稱Ccreditint成績Ccreditint學分三概要設計3.1 系統總體功能根據本設計的要求可以得到如圖3-1所示的系統功能圖。學生選課系統用戶登錄學生用戶管理員教師用戶個人信息選課結果選課列表選課要求刪除修改瀏覽添加個人信息刪除修改瀏覽退出登錄圖3-1 系統功能圖3.2 系統功能模塊設計本系統需要完成的功能主要有:(1)有關學生信息的輸入,包括輸入學生基本信息、所選課程。(2)學生信息的查詢、修改、刪除。(3)課程管理信息的添加、修改
7、、刪除和瀏覽等。(4)學生選課管理信息的查詢、添加、修改、刪除。(5)學生實現選擇課程和退選課程的功能。 (6)教師實現查詢學生選的課并給學生成績。 四詳細設計4.1登陸界面的設計 登錄模塊提供用戶登錄界面,用戶輸入正確的用戶名和密碼后,則可進入系統主窗口(即導航頁面),從而可以選擇進入相應的子系統。 在系統登錄界面中,單擊【確定】按鈕驗證用戶名和用戶密碼,若正確則進入系統主界面;否則彈出錯誤提示,并等待用戶的重新輸入。單擊【取消】按鈕則關閉登錄界面,退出系統。首先打開Visual Studio 2008,新建一個Windows 應用程序,命名為“學生選課系統”,再為應用程序添加一個窗體。然后
8、在窗體合適位置添加所需要的組件并設置相應屬性。 接下來編寫登錄模塊的代碼,部分代碼如下所示。string LJ = server=.;database=myd;uid=sa;pwd=;/建立連接 SqlConnection conn = new SqlConnection(LJ); conn.Open();/讀取所輸入的用戶名和密碼 SqlCommand comm = conn.CreateCommand(); if (rbAdmin.Checked) string sql = SELECT adminname,adminpas FROM admin WHERE(adminname= + tb
9、Name.Text + ); comm.CommandText = sql; SqlDataReader datar = comm.ExecuteReader(); DateTime dt = new DateTime(2008, 1, 1); if (DateTime.Now = dt) MessageBox.Show(程序已經過期,請聯系開發商!, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); Close();/判斷是否存在輸入的用戶 else if (!datar.HasRows) MessageBox.Show(用戶
10、名不存在,請重新輸入!); tbName.Focus(); return; /讀取數據庫的內容,并與輸入的進行比較; while (datar.Read() /判斷用戶輸入是否正確 if (dataradminpas.ToString().Trim() != tbPas.Text.Trim() MessageBox.Show(用戶密碼不正確,請重新輸入!); tbPas.Focus(); return; else AdminLogin f2 = new AdminLogin(); f2.ShowDialog(); Close(); else if (rbStudent.Checked) str
11、ing sql = SELECT sno,spas FROM student WHERE(sno= + tbName.Text + ); comm.CommandText = sql; SqlDataReader datar = comm.ExecuteReader(); DateTime dt = new DateTime(2008, 1, 1); if (DateTime.Now = dt) MessageBox.Show(程序已經過期,請聯系開發商!, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); /
12、判斷是否存在輸入的用戶 else if (!datar.HasRows) MessageBox.Show(用戶名不存在,請重新輸入!); tbName.Focus(); return; /讀取數據庫的內容,并與輸入的進行比較; while (datar.Read() /判斷用戶輸入是否正確 if (datarspas.ToString().Trim() != tbPas.Text.Trim() MessageBox.Show(用戶密碼不正確,請重新輸入!); tbPas.Focus(); return; else StudentLogin f3 = new StudentLogin(); f3
13、.ShowDialog(); Close(); else string sql = SELECT tno,tpas FROM teacher WHERE(tno= + tbName.Text + ); comm.CommandText = sql; SqlDataReader datar = comm.ExecuteReader(); DateTime dt = new DateTime(2008, 1, 1); if (DateTime.Now = dt) MessageBox.Show(程序已經過期,請聯系開發商!, 系統提示:, MessageBoxButtons.OK, Message
14、BoxIcon.Information); Close(); /判斷是否存在輸入的用戶 else if (!datar.HasRows) MessageBox.Show(用戶名不存在,請重新輸入!); tbName.Focus(); return; /讀取數據庫的內容,并與輸入的進行比較; while (datar.Read() /判斷用戶輸入是否正確 if (datartpas.ToString().Trim() != tbPas.Text.Trim() MessageBox.Show(用戶密碼不正確,請重新輸入!); tbPas.Focus(); return; else TeacherL
15、ogin f4 = new TeacherLogin(); f4.ShowDialog(); Close(); 完成后的界面效果如圖4.1所示圖4.1登陸界面4.2管理員登陸界面設計按照以上步驟設計一個管理員登陸界面如圖4.2所示。 圖4.2管理員登陸界面4.3教師登陸界面設計 首先打開Visual Studio 2008,新建一個Windows 應用程序,再為應用程序添加一個窗體。然后在窗體合適位置添加所需要的組件并設置相應屬性。 部分代碼如下所示:using System;using System.Collections.Generic;using System.ComponentMode
16、l;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace myd public partial class TeacherLogin : Form public TeacherLogin() InitializeComponent(); private void butOK_Click(object sender, EventArgs e) if (tbSearch.Text.Length = 0) Mes
17、sageBox.Show(查詢條件不能為空, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; int i; if (int.TryParse(tbSearch.Text, out i) if (tbSearch.Text.Length = 0) MessageBox.Show(學號必需為數字, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; SqlConnection cnn = new SqlConnection (Data
18、Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(); cmd.CommandText = SC_Info_Search; cmd.Parameters.Add(SearchType, SqlDbType.Decimal); cmd.Parameters.Add(SearchText, SqlDbType.VarChar, 50); i = 0; cmd.ParametersSearchType.Value = i; cmd.ParametersSearchText.Value
19、 = tbSearch.Text.Trim(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cnn; SqlDataAdapter sda = new SqlDataAdapter(cmd); try DataSet ds = new DataSet(); sda.Fill(ds);/填充數據集 sCBindingSource.DataSource = ds.Tables0;/將數據集顯示出來 /把查詢出來的數據綁定到相關控件 tbCj.DataBindings.Clear(); tbCj.DataBindi
20、ngs.Add(Text, sCBindingSource, score); catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); private void butSave_Click(object sender, EventArgs e) string sql; sql = update SC set score= + tbCj.Text + where sno= + (DataRowView)sCBindingSour
21、ce.Current)sno.ToString(); SqlConnection cnn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(sql, cnn); try cnn.Open();/打開連接 cmd.ExecuteNonQuery(); MessageBox.Show(數據保存成功, 系統提示:); catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Messa
22、ge, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); finally if (cnn.State = ConnectionState.Open) cnn.Close();/關閉連接 完成后的界面效果如圖4.3所示 圖4.3教師登陸界面4.4學生登陸界面設計1首先打開Visual Studio 2005。2新建一個工程,工程名為:StudentLogin3在窗體上放置數據顯示工具DataGridView1、DataGridView24設置DataGridView1和DataGridView2任務,在選擇數據源中,選擇添加項目數據源,根據數
23、據源配置向導來添加,和數據庫名為myd中的學生表連接起來,添加成功時,選擇數據源為courseBindingSource和sCBindingSource。5在窗體上放置GroupBox組件GroupBox1,RadioButton組件RadioButton1、RadioButton2、RadioButton3、RadioButton 4、RadioButton 5,Label組件Label1、Label2、Label3,Button組件Button1、Button2、Button3、Button4、Button5,TextBox組件TextBox1到TextBox46設置GroupBox的屬性
24、中的Text:GroupBox1的Text中輸入:查詢條件。7設置Button的屬性中的Text:Button1到Button5的Text中分別輸入:確認、返回、選中此課、退了此課、確定。8設置Button的屬性中的Name:確認、返回、選中此課、退了此課、確定的Name中分別輸入:btnOK、btnCancel、butXzck、butTlck、butOK2。9設置Label的屬性中的Text:Label1到Label3的Text中分別輸入:課程代碼、輸入自己的學號、輸入自己的學號查找自己所選的課程和成績。10設置RadioButton的屬性中的Name:RadioButton1到RadioB
25、utton5的Name中分別輸入:rbKcdm、rbKcmc、rbXf、rbKkx、rbRkls。11設置RadioButton的屬性中的Text:RadioButton1到RadioButton3的Text中分別輸入:課程代碼、課程名稱、學分、開課系、任課老師。12設置RadioButton1的屬性中的checked設置為True。13設置TextBox的屬性中的Name:TextBox1到TextBox4的Name中分別輸入:tbSearch、tbNo、tbsno、tbSearch2。14分別雙擊確認、確認、返回、選中此課、退了此課、確定切換到代碼窗口,輸入代碼,代碼如下:using Sy
26、stem;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace myd public partial class StudentLogin : Form public StudentLogin() InitializeComponent(); private bool Insert_fl
27、ag = false; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) Insert_flag = false; private void StudentLogin_Load(object sender, EventArgs e) this.courseTableAdapter.Fill(this.mydDataSet5.course); private void btnOK_Click(object sender, EventArgs e) if (tbSearch.Text.L
28、ength = 0) MessageBox.Show(查詢條件不能為空, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; int i; if (rbXf.Checked & int.TryParse(tbSearch.Text, out i) if (tbSearch.Text.Length = 0) MessageBox.Show(學分必需為數字, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; SqlConnection c
29、nn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(); cmd.CommandText = Course_Info_Search; cmd.Parameters.Add(SearchType, SqlDbType.Decimal); cmd.Parameters.Add(SearchText, SqlDbType.VarChar, 50); if (rbKcdm.Checked) i = 0; else if (rbKc
30、mc.Checked) i = 1; else if (rbXf.Checked) i = 2; else if (rbKkx.Checked) i = 3; else i = 4; cmd.ParametersSearchType.Value = i; cmd.ParametersSearchText.Value = tbSearch.Text.Trim(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cnn; SqlDataAdapter sda = new SqlDataAdapter(cmd); tr
31、y DataSet ds = new DataSet(); sda.Fill(ds);/填充數據集 courseBindingSource.DataSource = ds.Tables0; /將數據集顯示出來 /把查詢出來的數據綁定到相關控件 tbNo.DataBindings.Clear(); tbNo.DataBindings.Add(Text, courseBindingSource, cno); if (ds.Tables0.Rows.Count = 0) Insert_flag = true; catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原
32、因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); private void btnCancel_Click(object sender, EventArgs e) Close(); private void butXzck_Click(object sender, EventArgs e) string sql; sql = Insert into SC(sno,cno) values( + tbsno.Text + , + tbNo.Text + ); SqlConnection cnn = new Sq
33、lConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(sql, cnn); try cnn.Open();/打開連接 cmd.ExecuteNonQuery(); MessageBox.Show(數據保存成功, 系統提示:); catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error
34、); finally if (cnn.State = ConnectionState.Open) cnn.Close();/關閉連接 private void butTlck_Click(object sender, EventArgs e) string sql; sql = delete from SC where cno= + tbNo.Text + ; SqlConnection cnn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new S
35、qlCommand(sql, cnn); try cnn.Open();/打開連接 cmd.ExecuteNonQuery(); MessageBox.Show(數據刪除成功, 系統提示:); catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); finally if (cnn.State = ConnectionState.Open) cnn.Close();/關閉連接 private void butOK2_Click
36、(object sender, EventArgs e) if (tbSearch2.Text.Length = 0) MessageBox.Show(查詢條件不能為空, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; int i; if (int.TryParse(tbSearch2.Text, out i) if (tbSearch2.Text.Length = 0) MessageBox.Show(學號必需為數字, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.I
37、nformation); return; SqlConnection cnn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(); cmd.CommandText = SC_Info_Search; cmd.Parameters.Add(SearchType, SqlDbType.Decimal); cmd.Parameters.Add(SearchText, SqlDbType.VarChar, 50); i = 0; c
38、md.ParametersSearchType.Value = i; cmd.ParametersSearchText.Value = tbSearch2.Text.Trim(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cnn; SqlDataAdapter sda = new SqlDataAdapter(cmd); try DataSet ds = new DataSet(); sda.Fill(ds);/填充數據集 sCBindingSource.DataSource = ds.Tables0; /
39、將數據集顯示出來 catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); 完成后的界面效果如圖4.4所示。圖4.4學生登陸界面4.5.學生信息維護界面設計1首先打開Visual Studio 2005。2新建一個工程,工程名為:StudentInfo3在新建的項目StudentInfo中添加一個名為SqlHelper.cs的類,并打開此類,找到public static string CONNSTR = Data Sourc
40、e=.;Initial Catalog=myd;User ID=sa;Password=;并修改。4在窗體上放置數據顯示工具DataGridView。5設置DataGridView任務,在選擇數據源中,選擇添加項目數據源,根據數據源配置向導來添加,和數據庫名為myd中的學生 表連接起來,添加成功時,選擇數據源為studentBindingSource。6在窗體上放置GroupBox組件GroupBox1,RadioButton組件RadioButton1、RadioButton2、RadioButton3,Label組件Label1、Label2、Label3、Label4、Label5、La
41、bel6,Button組件Button1、Button2、Button3,TextBox組件TextBox1到TextBox77設置GroupBox的屬性中的Text:GroupBox1的Text中輸入:查詢條件。8設置Button的屬性中的Text:Button1到Button5的Text中分別輸入:確認、返回、新增、存盤、刪除。9設置Button的屬性中的Name:確認、返回、新增、存盤、刪除的Name中分別輸入:btnOK、btnCancel、butNew、btnSave、butDel。10設置Label的屬性中的Text:Label1到Label6的Text中分別輸入:學號、姓名、所在
42、系、性別、出生日期、密碼。11設置RadioButton的屬性中的Name:RadioButton1到RadioButton3的Name中分別輸入:rbXh、rbXm、rbSzx。12設置RadioButton的屬性中的Text:RadioButton1到RadioButton3的Text中分別輸入:學號、姓名、所在系。13設置RadioButton1的屬性中的checked設置為True。14設置TextBox的屬性中的Name:TextBox1到TextBox7的Name中分別輸入:tbSearch、tbXh、tbXm、tbSzx、tbXb、tbCsrq、tbMm。15分別雙擊確認、返回、
43、新增、存盤、刪除切換到代碼窗口,輸入代碼,代碼如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace myd public partial class StudentInfo : Form public StudentInfo() InitializeCom
44、ponent(); private bool Insert_flag = false; private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) Insert_flag = false; private void StudentInfo_Load(object sender, EventArgs e) / TODO: 這行代碼將數據加載到表“mydDataSet1.student”中。您可以根據需要移動或移除它。 this.studentTableAdapter.Fill(this.mydD
45、ataSet1.student); private void btnOK_Click(object sender, EventArgs e) if (tbSearch.Text.Length = 0) MessageBox.Show(查詢條件不能為空, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; int i; if (rbXh.Checked & int.TryParse(tbSearch.Text, out i) if (tbSearch.Text.Length = 0) MessageBox.Show(
46、學號必需為數字, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Information); return; SqlConnection cnn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(); cmd.CommandText = Student_Info_Search; cmd.Parameters.Add(SearchType, SqlDbType.Decimal); cmd.
47、Parameters.Add(SearchText, SqlDbType.VarChar, 50); if (rbXh.Checked) i = 0; else if (rbXm.Checked) i = 1; else i = 2; cmd.ParametersSearchType.Value = i; cmd.ParametersSearchText.Value = tbSearch.Text.Trim(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = cnn; SqlDataAdapter sda = n
48、ew SqlDataAdapter(cmd); try DataSet ds = new DataSet(); sda.Fill(ds);/填充數據集 studentBindingSource.DataSource = ds.Tables0; /將數據集顯示出來 /把查詢出來的數據綁定到相關控件 tbXh.DataBindings.Clear(); tbXm.DataBindings.Clear(); tbSzx.DataBindings.Clear(); tbXb.DataBindings.Clear(); tbCsrq.DataBindings.Clear(); tbMm.DataBind
49、ings.Clear(); tbXh.DataBindings.Add(Text, studentBindingSource, sno); tbXm.DataBindings.Add(Text,studentBindingSource, sname); tbSzx.DataBindings.Add(Text,studentBindingSource, sdept); tbXb.DataBindings.Add(Text, studentBindingSource, ssex); tbCsrq.DataBindings.Add(Text, studentBindingSource, sdate)
50、; tbMm.DataBindings.Add(Text, studentBindingSource, spas); if (ds.Tables0.Rows.Count = 0) Insert_flag = true; catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); private void btnCancel_Click(object sender, EventArgs e) Close(); private vo
51、id butNew_Click(object sender, EventArgs e) tbXh.Text = ; tbXm.Text = ; tbSzx.Text = ; tbXb.Text = ; tbCsrq.Text = ; tbMm.Text = ; Insert_flag = true; private void btnSave_Click(object sender, EventArgs e) string sql; if (Insert_flag) sql = Insert into student(sno,sname,sdept,ssex,sdate,spas) values
52、( + tbXh.Text + , + tbXm.Text + , + tbSzx.Text + , + tbXb.Text + , + tbCsrq.Text + , + tbMm.Text + ); else sql = update student set sno= + tbXh.Text + ,sname= + tbXm.Text + ,sdept= + tbSzx.Text + ,ssex= + tbXb.Text + ,sdate= + tbCsrq.Text + ,spas= + tbMm.Text + where CID= + (DataRowView)studentBindi
53、ngSource.Current)CID.ToString(); SqlConnection cnn = new SqlConnection (Data Source=.;Initial Catalog=myd;User ID=sa;Password=); SqlCommand cmd = new SqlCommand(sql, cnn); try cnn.Open();/打開連接 cmd.ExecuteNonQuery(); MessageBox.Show(數據保存成功, 系統提示:); catch (Exception ex) MessageBox.Show(出現錯誤,錯誤原因為 + ex
54、.Message, 系統提示:, MessageBoxButtons.OK, MessageBoxIcon.Error); finally if (cnn.State = ConnectionState.Open) cnn.Close();/關閉連接 private void fillByToolStripButton_Click(object sender, EventArgs e) try this.studentTableAdapter.FillBy(this.mydDataSet1.student); catch (System.Exception ex) System.Windows.Forms.MessageBox.Show(ex.Message); privat
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 濰坊學院《食品酶學》2023-2024學年第二學期期末試卷
- 模電 7-信號的運算和處理學習資料
- 江蘇省蘇州市常熟一中達標名校2025屆第二學期期末統一考試(數學試題理)試題含解析
- 六安職業技術學院《西方文化與近代中國》2023-2024學年第一學期期末試卷
- 南通職業大學《行為矯正》2023-2024學年第一學期期末試卷
- 遼寧傳媒學院《分析代數方法選講》2023-2024學年第一學期期末試卷
- 二零二五廣告合同范例大全
- 展會知識產權保護合同范例
- 委托代理采購協議書二零二五年
- 房地產項目顧問合同書二零二五年
- 二年級下冊科學不斷發展的人工產品鄂教版課件
- 小學部編版六年級下冊道德與法治《4、地球-我們的家園》第一課時說課稿
- DB11T 1340-2022 居住建筑節能工程施工質量驗收規程
- 保險市場調查與分析實訓三任務一2.3.1任務一運用Excel整理市場調查問卷數據
- 中央空調(多聯機)施工方案
- PKPM磚混結構抗震及其他計算全攻略
- “育鯤”輪轉葉式舵機工作原理和電氣控制以及故障分析
- 流動資金自動測算表(內自帶計算公式)
- 最新.爾雅批判與創意思考--馮林答案
- 宿州光伏玻璃項目可行性研究報告(范文模板)
- 10KV變電站施工方案
評論
0/150
提交評論