版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
-.z.這個(gè)是添加的代碼usingSystem;usingSystem.Collections.Generic;usingSystem.ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Te*t;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace學(xué)生成績管理系統(tǒng){publicpartialclassstudentluru:Form{//CurrencyManagercmAmend;//SqlConnectionsqlConnection1=newSqlConnection();publicstudentluru(){Initializeponent();}privatevoidstudentluru_Load(objectsender,EventArgse){}//錄入privatevoidbutton5_Click(objectsender,EventArgse){stringsno=te*tBo*1.Te*t;stringsname=te*tBo*2.Te*t;stringsse*=te*tBo*3.Te*t;stringsage=te*tBo*4.Te*t;stringsclass=te*tBo*5.Te*t;stringsdept=te*tBo*6.Te*t;stringsaddress=te*tBo*7.Te*t;stringsphone=te*tBo*8.Te*t;stringsqq=te*tBo*9.Te*t;if(te*tBo*1.Te*t==""||te*tBo*2.Te*t==""||te*tBo*5.Te*t==""){if(te*tBo*1.Te*t==""){MessageBo*.Show("**不能為空","警告提示",MessageBo*Buttons.OKCancel,MessageBo*Icon.Error);te*tBo*1.Focus();return;}if(te*tBo*2.Te*t==""){MessageBo*.Show("不能為空","警告提示",MessageBo*Buttons.OKCancel,MessageBo*Icon.Error);te*tBo*2.Focus();return;}if(te*tBo*5.Te*t==""){MessageBo*.Show("班級不能為空","警告提示",MessageBo*Buttons.OKCancel,MessageBo*Icon.Error);te*tBo*5.Focus();return;}}else{stringconnstr="server=IT32;uid=sa;pwd='sa';database=sc;";try{SqlConnectionconn=newSqlConnection(connstr);conn.Open();stringsqlinsert="insertintostudentinfovalues('"+sno+"','"+sname+"','"+sse*+"','"+sage+"','"+sclass+"','"+sdept+"','"+saddress+"','"+sphone+"','"+sqq+"')";Sqlmandsc=newSqlmand(sqlinsert,conn);sc.E*ecuteNonQuery();te*tBo*1.Te*t="";te*tBo*2.Te*t="";te*tBo*3.Te*t="";te*tBo*4.Te*t="";te*tBo*5.Te*t="";te*tBo*6.Te*t="";te*tBo*7.Te*t="";te*tBo*8.Te*t="";te*tBo*9.Te*t="";MessageBo*.Show("數(shù)據(jù)已經(jīng)添加成功","溫馨提示");conn.Close();}catch(E*ceptione*){MessageBo*.Show(e*.ToString());}}}privatevoidbutton8_Click(objectsender,EventArgse){this.Dispose();}}}這個(gè)是查詢界面的代碼:usingSystem;usingSystem.Collections.Generic;usingSystem.ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Te*t;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace學(xué)生成績管理系統(tǒng){publicpartialclassstudentcha*un:Form{DataTabledt=newDataTable();stringper;stringsno;CurrencyManagercmAmend;publicstudentcha*un(){Initializeponent();}publicstudentcha*un(stringk,strings){Initializeponent();per=k;sno=s;}privatevoidstudentcha*un_Load(objectsender,EventArgse){//TODO:這行代碼將數(shù)據(jù)加載到表“studentDataSet.studentinfo”中。您可以根據(jù)需要移動或移除它。//this.studentinfoTableAdapter.Fill(this.studentDataSet.studentinfo);//數(shù)據(jù)綁定if(per=="超級用戶"){stringsqlsel="select*fromstudentinfo";DataTabledt=bangding(sqlsel);cmAmend=(CurrencyManager)BindingConte*t[dt];this.dataGridView1.DataSource=dt;this.boBo*1.DataSource=dt;this.boBo*1.DisplayMember="sno";this.boBo*2.DataSource=dt;this.boBo*2.DisplayMember="sname";}if(per=="普通用戶"){stringsqlsel="select*fromstudentinfowheresno='"+sno+"'";DataTabledt=bangding(sqlsel);cmAmend=(CurrencyManager)BindingConte*t[dt];this.dataGridView1.DataSource=dt;this.boBo*1.DataSource=dt;this.boBo*1.DisplayMember="sno";this.boBo*2.Enabled=false;this.radioButton2.Enabled=false;//this.toolStripButton1.Enabled=false;//this.toolStripButton2.Enabled=false;//this.toolStripButton3.Enabled=false;//this.toolStripButton4.Enabled=false;//this.boBo*2.DataSource=dt;//this.boBo*2.DisplayMember="sname";}}DataTablebangding(stringsqlsel){stringconnstr="server=.;uid=sa;pwd=sa;database=sc";using(SqlConnectionconn=newSqlConnection(connstr)){conn.Open();DataSetds=newDataSet();SqlDataAdapterda=newSqlDataAdapter(sqlsel,conn);da.Fill(ds,"coust");DataTabledt=ds.Tables["coust"];conn.Close();returndt;}}privatevoidbutton1_Click(objectsender,EventArgse){if(this.radioButton1.Checked==true){string*uehao=boBo*1.Te*t;stringsqlsel="select*fromstudentinfowheresno='"+*uehao+"'";this.dataGridView1.DataSource=bangding(sqlsel);}else{string*ingming=boBo*2.Te*t;stringsqlsel="select*fromstudentinfowheresname='"+*ingming+"'";this.dataGridView1.DataSource=bangding(sqlsel);}}privatevoidradioButton1_CheckedChanged(objectsender,EventArgse){if(this.radioButton1.Checked==true){this.boBo*1.Enabled=true;this.boBo*2.Enabled=false;}else{this.boBo*1.Enabled=false;this.boBo*2.Enabled=true;}}privatevoidcheckstate(intpos){if(pos==0){toolStripButton1.Enabled=false;toolStripButton2.Enabled=false;toolStripButton3.Enabled=true;toolStripButton4.Enabled=true;}else{toolStripButton1.Enabled=true;toolStripButton2.Enabled=true;toolStripButton3.Enabled=true;toolStripButton4.Enabled=true;}}//首記錄privatevoidtoolStripButton1_Click(objectsender,EventArgse){cmAmend.Position=0;//設(shè)置為0.回到首記錄this.dataGridView1.Select();checkstate(cmAmend.Position);}//上一條privatevoidtoolStripButton2_Click(objectsender,EventArgse){cmAmend.Position--;this.dataGridView1.Select();checkstate(cmAmend.Position);}//下一條privatevoidtoolStripButton3_Click(objectsender,EventArgse){cmAmend.Position++;this.dataGridView1.Select();checkstate(cmAmend.Position);}//末記錄privatevoidtoolStripButton4_Click(objectsender,EventArgse){cmAmend.Position=cmAmend.Count-1;this.dataGridView1.Select();checkstate(cmAmend.Position);}}}刪除的代碼:usingSystem;usingSystem.Collections.Generic;usingSystem.ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Te*t;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace學(xué)生成績管理系統(tǒng){publicpartialclassstudentshanchu:Form{CurrencyManagercmAmend;publicstudentshanchu(){Initializeponent();}privatevoidstudentshanchu_Load(objectsender,EventArgse){//TODO:這行代碼將數(shù)據(jù)加載到表“studentDataSet.studentinfo”中。您可以根據(jù)需要移動或移除它。//this.studentinfoTableAdapter.Fill(this.studentDataSet.studentinfo);//數(shù)據(jù)綁定stringsqlsel="select*fromstudentinfo";DataTabledt=bangding(sqlsel);cmAmend=(CurrencyManager)BindingConte*t[dt];this.dataGridView1.DataSource=dt;this.te*tBo*1.DataBindings.Add("te*t",dt,"sno");this.te*tBo*2.DataBindings.Add("te*t",dt,"sname");this.te*tBo*3.DataBindings.Add("te*t",dt,"sse*");this.te*tBo*4.DataBindings.Add("te*t",dt,"sage");this.te*tBo*5.DataBindings.Add("te*t",dt,"sclass");this.te*tBo*6.DataBindings.Add("te*t",dt,"sdept");this.te*tBo*7.DataBindings.Add("te*t",dt,"saddress");this.te*tBo*8.DataBindings.Add("te*t",dt,"sphone");this.te*tBo*9.DataBindings.Add("te*t",dt,"sqq");}DataTablebangding(stringsqlsel){stringconnstr="server=.;uid=sa;pwd=sa;database=sc";using(SqlConnectionconn=newSqlConnection(connstr)){conn.Open();DataSetds=newDataSet();SqlDataAdapterda=newSqlDataAdapter(sqlsel,conn);da.Fill(ds,"coust");DataTabledt=ds.Tables["coust"];conn.Close();returndt;}}privatevoidcheckBo*1_CheckedChanged(objectsender,EventArgse){if(checkBo*1.Checked==true){this.Height=450;}else{this.Height=250;}}privatevoidbutton1_Click(objectsender,EventArgse){if(MessageBo*.Show("你確定要?jiǎng)h除該記錄嗎","詢問",MessageBo*Buttons.OKCancel,MessageBo*Icon.Question)==DialogResult.OK){intpos=this.dataGridView1.CurrentCell.RowInde*;//獲取該行stringconnstr="server=.;uid=sa;pwd=sa;database=sc";using(SqlConnectionconn=newSqlConnection(connstr)){conn.Open();DataSetds=newDataSet();stringsqlset="select*fromstudentinfo";//數(shù)據(jù)集SqlDataAdapterda=newSqlDataAdapter(sqlset,conn);da.Fill(ds,"coust");DataTabledt=ds.Tables["coust"];SqlmandBuildercb=newSqlmandBuilder(da);dt.Rows[pos].Delete();da.Update(ds,"coust");te*tBo*1.Te*t="";te*tBo*2.Te*t="";te*tBo*3.Te*t="";te*tBo*4.Te*t="";te*tBo*5.Te*t="";te*tBo*6.Te*t="";te*tBo*7.Te*t="";te*tBo*8.Te*t="";te*tBo*9.Te*t="";this.dataGridView1.DataSource=bangding(sqlset);MessageBo*.Show("恭喜你已成功刪除","溫馨提示");conn.Close();}}}}}修改的代碼:usingSystem;usingSystem.Collections.Generic;usingSystem.ponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Te*t;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace學(xué)生成績管理系統(tǒng){publicpartialclassstudent*iugai:Form{stringconnstr="server=.;uid=sa;pwd=sa;database=sc";stringper;stringsno;CurrencyManagercmAmend;publicstudent*iugai(){Initializeponent();}publicstudent*iugai(stringk,strings){Initializeponent();per=k;sno=s;}privatevoidcheckBo*1_CheckedChanged(objectsender,EventArgse){if(checkBo*1.Checked==true){//this.Height=450;boBo*1.Enabled=false;te*tBo*1.Enabled=false;}else{//this.Height=250;boBo*1.Enabled=true;te*tBo*1.Enabled=true;}}privatevoidstudent*iugai_Load(objectsender,EventArgse){//數(shù)據(jù)綁定if(per=="超級用戶"){stringsqlsel="select*fromstudentinfoorderbysnoasc";DataTabledt=bangding(sqlsel);cmAmend=(CurrencyManager)BindingConte*t[dt];this.boBo*1.DataSource=dt;this.boBo*1.DisplayMember="sno";this.te*tBo*1.DataBindings.Add("te*t",dt,"sname");this.te*tBo*2.DataBindings.Add("te*t",dt,"sse*");this.te*tBo*3.DataBindings.Add("te*t",dt,"sage");this.te*tBo*4.DataBindings.Add("te*t",dt,"sclass");this.te*tBo*5.DataBindings.Add("te*t",dt,"sdept");this.te*tBo*6.DataBindings.Add("te*t",dt,"saddress");this.te*tBo*7.DataBindings.Add("te*t",dt,"sphone");this.te*tBo*8.DataBindings.Add("te*t",dt,"sqq");}if(per=="普通用戶"){stringsqlsel="select*fromstudentinfowheresno='"+sno+"'";DataTabledt=bangding(sqlsel);this.boBo*1.DataSource=dt;this.boBo*1.DisplayMember="sno";this.te*tBo*1.DataBindings.Add("te*t",dt,"sname");this.te*tBo*2.DataBindings.Add("te*t",dt,"sse*");this.te*tBo*3.DataBindings.Add("te*t",dt,"sage");this.te*tBo*4.DataBindings.Add("te*t",dt,"sclass");this.te*tBo*5.DataBindings.Add("te*t",dt,"sdept");this.te*tBo*6.DataBindings.Add("te*t",dt,"saddress");this.te*tBo*7.DataBindings.Add("te*t",dt,"sphone");this.te*tBo*8.DataBindings.Add("te*t",dt,"sqq");}}DataTablebangding(stringsqlsel){//stringconnstr="server=.;uid=sa;pwd=sa;database=sc";using(SqlConnectionconn=newSqlConnection(connstr)){conn.Open();DataSetds=newDataSet();SqlDataAdapterda=newSqlDataAdapter(sqlsel,conn);da.Fill(ds,"coust");DataTabledt=ds.Tables["coust"];conn.Close();returndt;}}privatevoidbutton1_Click(objectsender,EventArgse){if(checkBo*1.Checked==true){stringsno=boBo*1.Te*t;stringsname=te*tBo*1.Te*t;stringse*=te*tBo*2.Te*t;stringage=te*tBo*3.Te*t;stringsclass=te*tBo*4.Te*t;stringsdept=te*tBo*5.Te*t;stringsaddress=te*tBo*6.Te*t;stringsphone=te*tBo*7.Te*t;stringsqq=te*tBo*8.Te*t;if(te*tBo*2.Te*t==""||te*tBo*3.Te*t
溫馨提示
- 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)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025黑龍江雙鴨山市集賢縣大美七星山旅游管理有限公司招聘人員32人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025福建泉州市日升教育管理有限公司2025年招聘從事教學(xué)工作人員136人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025年浙江中煙工業(yè)有限責(zé)任公司職業(yè)院校招聘7人筆試參考題庫附帶答案詳解(3卷)
- 2025年中鐵一局集團(tuán)有限公司社會招聘204人筆試參考題庫附帶答案詳解(3卷)
- 2025國鐵投資發(fā)展有限公司公開招聘2人筆試參考題庫附帶答案詳解(3卷)
- 臺州市2024浙江臺州市溫嶺市醫(yī)療急救指揮中心招聘編制外人員1人筆試歷年參考題庫典型考點(diǎn)附帶答案詳解(3卷合一)
- 臨安區(qū)2024年浙江杭州市臨安區(qū)市場監(jiān)督管理局編外招1人筆試歷年參考題庫典型考點(diǎn)附帶答案詳解(3卷合一)
- 2026年廣西單招旅游管理專業(yè)中職生技能經(jīng)典題含答案含導(dǎo)游詞創(chuàng)作
- 2026年重慶單招文化素質(zhì)省統(tǒng)考經(jīng)典題含答案2023-2025年精校版
- 2026年貴州單招文化素質(zhì)語文專項(xiàng)訓(xùn)練含答案古詩文閱讀理解作文
- 西安市2024陜西西安市專職消防員管理中心招聘事業(yè)編制人員筆試歷年參考題庫典型考點(diǎn)附帶答案詳解(3卷合一)
- 吉安市農(nóng)業(yè)農(nóng)村發(fā)展集團(tuán)有限公司及下屬子公司2025年第二批面向社會公開招聘備考題庫有答案詳解
- 文冠果整形修剪課件
- 2025年鹽城港控股招聘面試題庫及答案
- 2026年益陽醫(yī)學(xué)高等??茖W(xué)校單招職業(yè)技能測試題庫附答案
- 國家開放大學(xué)《商務(wù)英語4》期末考試精準(zhǔn)題庫
- 2025秋季《中華民族共同體概論》期末綜合考試-國開(XJ)-參考資料
- 機(jī)械通氣患者誤吸預(yù)防及管理規(guī)范
- 2025年應(yīng)急環(huán)境監(jiān)測車行業(yè)分析報(bào)告及未來發(fā)展趨勢預(yù)測
- AI生成時(shí)代虛擬生產(chǎn)力與生產(chǎn)關(guān)系變革
- 船舶進(jìn)出港調(diào)度智能化方案
評論
0/150
提交評論