




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、教師管理操作流程1、 使用Teacher賬號登陸教師管理系統(tǒng)代碼區(qū)域:if (loginType = "教師") string sql = string.Format("select count(*) from teacher where LoginId='0' AND LoginPwd='1'", loginId, loginPwd); try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open()
2、; count = (int)command.ExecuteScalar(); if (count = 1) isValidUser = true; else index+; if (index <= 3) message = "用戶名或密碼不存在!" else if (index >= 3) Application.Exit(); isValidUser = false; catch (Exception ex) message = ex.Message; Console.WriteLine(ex.Message); 查詢修改信息查詢教師基本信息(代碼區(qū)域:)
3、 TeacherBaseForm teacherBaseForm = new TeacherBaseForm(); teacherBaseForm.Show();TeacherBaseForm(教師基本信息窗體)查詢及修改學(xué)生信息(代碼區(qū)域:) UpdateStudentForm updateStudentForm = new UpdateStudentForm(); updateStudentForm.Show();SearchTeacherForm.cs(查詢及修改信息窗體)AddScoreForm(學(xué)生成績錄入窗體)錄入按鈕代碼:string sql = string.Format(&q
4、uot;select StudentId,StudentNo,StudentName from Student where StudentId='0'", txtId.Text); try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read() id = (int)reader"StudentId&
5、quot; no = (string)reader"StudentNo" name = (string)reader"StudentName" reader.Close(); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); if (TianJia() if (txtId.Text = Convert.ToString(id) && txtStudentNo.Text = no && txtStude
6、ntName.Text = name) string studentName = txtStudentName.Text; string sdudentNo = txtStudentNo.Text; string subject = cboSubject.Text; string score = txtScore.Text; int classId = GetClassId(); string studentId = txtId.Text; string sql1 = string.Format("insert into Score(StudentNo,Subject,SScore,
7、SName,ClassId,StudentId)values('0','1','2','3','4',5)", sdudentNo, subject, score, studentName, classId, studentId); try SqlCommand command = new SqlCommand(sql1, DBHelper.connection); DBHelper.connection.Open(); int result = command.ExecuteNonQuery(); if
8、 (result != 1) MessageBox.Show("添加失敗", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("添加成功", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception ex) /MessageBox.Show("操作數(shù)據(jù)庫出錯!", "輸入提示&quo
9、t;, MessageBoxButtons.OK, MessageBoxIcon.Information); /Console.WriteLine(ex.Message); MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); else MessageBox.Show("您輸入的學(xué)生在數(shù)據(jù)庫中沒有,請重新輸入", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); private void AddScoreFor
10、m_Load(object sender, EventArgs e) string sql = "select gradeName from Grade" try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read() string gradeName = (string)reader0; reader.Close
11、(); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); string sql1 = "select SubjectName from Subject" try SqlCommand command = new SqlCommand(sql1, DBHelper.connection); DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (
12、reader.Read() string subName = (string)reader0; reader.Close(); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); private void cboGrade_SelectedIndexChanged(object sender, EventArgs e) if"") int gradeId = -1; string sql = string.Format("select Grad
13、eId from Grade where GradeName='0'", cboGrade.Text); SqlCommand command = new SqlCommand(sql, DBHelper.connection); try DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.Read() gradeId = (int)reader0; reader.Close(); catch (Exception ex) MessageBox.S
14、how("操作數(shù)據(jù)庫出錯"); Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); sql = "SELECT ClassName FROM Class WHERE GradeId=" + gradeId; command.CommandText = sql; try DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); string className = "&q
15、uot; while (reader.Read() className = (string)reader"ClassName" reader.Close(); catch (Exception ex) MessageBox.Show("操作數(shù)據(jù)庫出錯"); Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); private void txtId_TextChanged(object sender, EventArgs e) UpdateScoreForm(更新成績窗體)保存按鈕代碼:DialogResult result = MessageBox.Show("確實要將修改保存到數(shù)據(jù)庫嗎?", "輸入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); if (result = DialogResult.OK) SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter); dataAdapte
溫馨提示
- 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)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 泰安無塵潔凈室施工方案
- 電力采集裝置安裝施工方案
- 法學(xué)院學(xué)生會干事工作總結(jié)
- 高中教師個人工作總結(jié)
- 化纖企業(yè)一季度安全事故應(yīng)急預(yù)案
- 財務(wù)總監(jiān)個人計劃
- 美術(shù)基礎(chǔ)知識培訓(xùn)課件
- 新大學(xué)生暑期下鄉(xiāng)社會實踐活動計劃
- 西師大2025年三年級語文下學(xué)期期中知識點歸納復(fù)習(xí)全能練習(xí)單
- 語文骨干教師個人培訓(xùn)工作總結(jié)
- 工業(yè)引風(fēng)機知識培訓(xùn)課件
- 《喜劇天賦提升》課件
- 第16課《青春之光》教學(xué)設(shè)計 2024-2025學(xué)年統(tǒng)編版語文七年級下冊
- 2025年哈爾濱幼兒師范高等??茖W(xué)校單招職業(yè)技能測試題庫1套
- 2025年湖南城建職業(yè)技術(shù)學(xué)院單招職業(yè)傾向性測試題庫及答案一套
- 2025廣東省安全員A證考試題庫
- 2025年廣東深圳高三一模高考英語試卷試題(含答案詳解)
- 《酒店服務(wù)禮儀細(xì)節(jié)》課件
- 《建筑工程混凝土施工質(zhì)量控制課件》
- 2025-2030年中國煤炭行業(yè)發(fā)展動態(tài)及前景趨勢分析報告
- 工程機械租賃服務(wù)方案及保障措施投標(biāo)方案文件
評論
0/150
提交評論