欢迎来到天天文库
浏览记录
ID:35394849
大小:60.72 KB
页数:11页
时间:2019-03-24
《班级管理系统c#代码展示》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、班级管理系统C#代码展示:UsingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmIControls;usingSystem.Data.SqlClient;publicpartialclass_Defaul
2、t:System.Web.UI.Page;{SqlConnectionconn=newSqlConnection();//publicvoidlianjie()//{//conn.Connectionstring=11DataSource=.;InitialCatalog=TeachingSystem;IntegratedSecurity=TrueH;//conn.Open();//}publicstringupdateclass(stringclassic!,stringclassname,stringdepartmentname,stringteacher
3、id){//SqlConnectionconn=newSqlConnection();conn.Connectionstring=”DataSource=.;InitialCatalog=TeachingSystem;IntegratedSecurity=TrueH;corm.Open();stringstr=null;stringsqlstr=HupdateTS_classsetTS_Class_name=@classname,TS_Class_department=@departmentname5TS_Class_teacherid=@teacheridw
4、hereTS_Class_id=@classid";SqlCommandcomm=newSqlCommand(sqlstr,conn);try{comm.Parameters.Add(newSqIParameter(”@classicT,SqlDbType.VarChar,50));comm.Parameters.Add(newSqlParameter(H@classnameH,SqlDbType.VarChar,50));comm.Parameters.Add(newSqlParameter(H@departmentname”,SqlDbType.VarCh
5、ar,50));comm.Parameters.Add(newSqlParameter(lt@teacheridfSqlDbType.VarChar,50));comm.Parameters[n@classidn].Value=classic!;comm.Parameters[n@classnamen].Value=classname;comm.Parameters[H@departmentnameH].Value=departmentname;comm.Parameters「@teachericT].Value=teacherid;//comm.Conne
6、ction.Open();comm.ExecuteNonQueryO;str=”更新成功“;}catch(Exceptionex){str=ex.Message;}comm.Connection.Close();returnstr;}publicDataSetQuery(stringselectstr){DataSetds=newDataSet();try{SqlDataAdapteradp=newSqlDataAdapter(selectstr,conn);adp.Fill(ds);}catch(Exception){}returnds;}publicint
7、NonQuery(stringsqlstr){inti=-1;SqlCommandcomm=newSqlCommand(sqlstr,conn);//comm.Connection.Open();try{i=comm・ExecuteNonQuery();}catch(Exception)}comm・Connection.Close();returni;publicvoidTS_BindGrid(){//lianjie();//SqlConnectionconn=newSqlConnection();conn.Connectionstring=11DataSou
8、rce=.;InitialCatalo
此文档下载收益归作者所有