首页 学生成绩管理系统代码c#+sql

学生成绩管理系统代码c#+sql

举报
开通vip

学生成绩管理系统代码c#+sql学生成绩管理系统代码c#+sql 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 学生成绩管理系统 { public partial cl...

学生成绩管理系统代码c#+sql
学生成绩管理系统代码c#+sql 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 学生成绩管理系统 { public partial class Login : Form { static public string sn,sub; public Login() { InitializeComponent(); } Form2 fr2 = new Form2(); Form3 fr3 = new Form3(); Form4 fr4 = new Form4();//———— ——————————————————————创建新窗体 private void Login_Load(object sender, EventArgs e) { timer1.Start(); // ———— ——————————————————————Timer控件 } private void btnlogin_Click(object sender, EventArgs e) {//Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa // string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa"; string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa"; SqlConnection conn = new SqlConnection(str);//————————————————— ——————————————————连接数据库 conn.Open(); if( txtname .Text==""||txtpassword .Text=="") MessageBox.Show ("请不要遗漏信息~"); if (rbtnmanager.Checked) { string cstr="select * from 用户登录 where 类别='管理员'and 用户名 ='"+txtname.Text.Trim ()+"'and 密码='"+txtpassword .Text.Trim ()+"'"; SqlCommand comm=new SqlCommand (cstr,conn ); SqlDataReader dr=comm.ExecuteReader (); if (dr.Read()) { sn = txtname.Text.Trim(); fr4.Show(); this.Visible = false; } else { MessageBox.Show("输入有误,请重新输入~"); txtname.Text = ""; txtpassword.Text = ""; } } if (rbtnteacher.Checked) { string cstr = "select * from 用户登录 where 类别='教师'and 用户名='" + txtname.Text.Trim() + "'and 密码='" + txtpassword.Text.Trim() + "'"; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) { sn = txtname.Text.Trim(); sub = dr.GetValue(3).ToString (); fr3.Show(); this.Visible = false; } else { MessageBox.Show("输入有误,请重新输入~"); txtname.Text = ""; txtpassword.Text = ""; } } if (rbtnstudent.Checked) { string cstr = "select * from 用户登录 where 类别='学生'and 用户名='" + txtname.Text.Trim() + "'and 密码='" + txtpassword.Text.Trim() + "'"; SqlCommand comm = new SqlCommand(cstr, conn); SqlDataReader dr = comm.ExecuteReader(); if (dr.Read()) { sn = txtname.Text.Trim();fr2.Show(); this.Visible=false ; } else { MessageBox.Show("输入有误,请重新输入~"); txtname.Text = ""; txtpassword.Text = ""; } } conn.Close(); conn.Dispose(); } private void button2_Click(object sender, EventArgs e) { Application.Exit(); } private void timer1_Tick(object sender, EventArgs e) { label1.Text = "当前时间为:" +DateTime.Now .ToLongDateString() +" "+DateTime.Now.ToLongTimeString(); } } } 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 学生成绩管理系统 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { label1.Text = Login.sn + "同学,欢迎您使用本成绩管理系统~";//————————————————————用窗体掉用静态变量 timer1.Start(); groupBox1.Visible = false; groupBox2.Visible = false; } private void button1_Click(object sender, EventArgs e) { } private void button3_Click(object sender, EventArgs e) { //string str = "Password=kzl;Persist Security Info=True;User ID=kzl;Initial Catalog=学生成绩管理系统;Data Source=(local)"; //SqlConnection conn = new SqlConnection(str); //conn.Open(); //SqlDataAdapter da = new SqlDataAdapter("Select * from 学生成绩表 where 姓名="+textBox1 .Text , conn); //DataSet ds = new DataSet(); //da.Fill(ds, "usertable"); //dataGridView1.DataSource = ; } private void toolStripButton1_Click(object sender, EventArgs e) { string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa"; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * from 学生成绩表 where 姓 名='" + Login.sn.Trim ()+"'",conn);//————详细信息 DataSet ds = new DataSet(); da.Fill(ds, "usertable"); dataGridView1.DataSource = ds.Tables["usertable"].DefaultView; conn.Close(); conn.Dispose(); } private void toolStripButton2_Click(object sender, EventArgs e) { } private void toolStripButton4_Click(object sender, EventArgs e) { groupBox1.Visible = true; } private void button1_Click_1(object sender, EventArgs e) { string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa"; SqlConnection conn = new SqlConnection(str); conn.Open(); if (txtnpd.Text != txtnpassword.Text) { MessageBox.Show("请确认信密码的正确 性~"); } if (txtnpd.Text ==""&& txtnpassword.Text == "") { MessageBox.Show("密码不允 许为空~"); } if (txtnpd.Text == txtnpassword.Text && txtnpd.Text!= "") { SqlCommand com = new SqlCommand("update 用户登录 set 密码='" + txtnpassword.Text.Trim() + "'where 用户名='" + Login.sn.Trim() + "'", conn); if (com.ExecuteNonQuery() == 1) { MessageBox.Show("密码修改成功~"); groupBox1.Visible = false; } } conn.Close(); conn.Dispose(); } private void toolStripButton5_Click(object sender, EventArgs e) { this.Close(); Login l = new Login(); l.Visible = true;//,,,,,,,,,,,, ,,,,,,,,,,,,,,、、、 } private void toolStripButton6_Click(object sender, EventArgs e) { // string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系 统;User ID=sa;Password=sa"; // SqlConnection conn = new SqlConnection(str); // conn.Open(); // SqlDataAdapter da = new SqlDataAdapter("Select * from 学生成绩表 where 姓名='" + Login.sn.Trim() + "'", conn); //DataSet ds = new DataSet(); // da.Fill(ds, "usertable"); // string s; // for (int i = 2; i <= 6; i++) // { // if (int.Parse(ds.Tables["usertable"].Rows[0][i].ToString()) < 60) // s=int.Parse(ds.Tables["usertable"].Rows[0][i].ToString()); // } } private void groupBox2_Enter(object sender, EventArgs e) { } private void toolStripButton3_Click(object sender, EventArgs e) { groupBox2.Visible = true ; string str = "Data Source=LEE-PC;Initial Catalog=学生成绩管理系统;User ID=sa;Password=sa"; SqlConnection conn = new SqlConnection(str); conn.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * from 学生成绩表 where 姓 名='" + Login.sn.Trim() + "'", conn); DataSet ds = new DataSet(); da.Fill(ds, "usertable"); int max=0,min=1001; double ave=0.0; for (int i = 2; i <= 6; i++) { if (int.Parse(ds.Tables["usertable"].Rows[0][i].ToString()) > max) max = int.Parse(ds.Tables["usertable"].Rows[0][i].ToString ()); if (int.Parse(ds.Tables["usertable"].Rows[0][i].ToString ())
本文档为【学生成绩管理系统代码c#+sql】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_005190
暂无简介~
格式:doc
大小:121KB
软件:Word
页数:26
分类:互联网
上传时间:2017-10-01
浏览量:566