毕业设计 - 高校成绩管理系统数据库设计与实现(8)

2019-08-03 14:31

(2)学生成绩名次排定: 截图:

(3)教师任课查询: 截图:

(4)学生信息插入: C#代码:

using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;

using System.Windows.Forms;

36

namespace C01luhai {

public partial class frmStudent : Form {

sqlConnect con = new sqlConnect(); public DataSet ds = new DataSet(); private string sql; public frmStudent() {

InitializeComponent(); ComBoxBind(); SetBind(); }

//----绑?¨?定?§DataGivdView数oy据Y protected void SetBind() {

sql = \学?ì生|¨2学?ì号?lh as 学?ì生|¨2学?ì号?,学?ì生|¨2姓?名?lh as 学?ì生|¨2姓?名?,班?¨¤级?编ਤ号?lh as 班?¨¤级?编ਤ号?,学?ì生|¨2性?别àelh as 学?ì生|¨2性?别àe,学?ì生|¨2年¨o龄¢?lh as 学?ì生|¨2年¨o龄¢?,生|¨2源??所¨′在¨2地ì?lh as 生|¨2源??所¨′在¨2地ì?,已°?修T学?ì分¤?总á¨1数oylh as 已°?修T学?ì分¤?总á¨1数oy from Studentslh\; try {

ds = con.BindDataGridView(dataGView, sql); dataGView.Columns[0].ReadOnly = true; dataGView.Columns[1].ReadOnly = true; dataGView.AllowUserToAddRows = false; } catch {

MessageBox.Show(\不?能¨1做á?该?操¨′作á??!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information); } }

//----绑?¨?定?§下?拉¤-框¨°数oy据Y protected void ComBoxBind() { try

{ //----对?下?拉¤-框¨°绑?¨?定?§学?ì院o信?息?é cmbSsex.DropDownStyle = ComboBoxStyle.DropDownList; cmbSsex.Items.Clear();

ds = con.Getds(\ 学?ì生|¨2学?ì号?lh,xuesheng 学?ì生|¨2姓?名?lh from Studentslh\);

cmbSsex.DisplayMember = \学?ì生|¨2姓?名?lh\; cmbSsex.ValueMember = \学?ì生|¨2学?ì号?lh\;

37

cmbSsex.DataSource = ds.Tables[0]; cmbSsex.SelectedIndex = 0; }

catch (Exception) {

MessageBox.Show(\不?能¨1做á?该?操¨′作á??!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information); } }

private void frmStudent_Load(object sender, EventArgs e) {

}

private void label1_Click(object sender, EventArgs e) {

}

private void laSno_Click(object sender, EventArgs e) {

}

private void textBox1_TextChanged(object sender, EventArgs e) {

}

private void btnDelete_Click(object sender, EventArgs e) {

if (MessageBox.Show(\确¨?¤定?§要°a删|?除y该?条??信?息?é吗e?ê?\, \提?¨¢示o?\, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { try {

string Sno = dataGView.CurrentRow.Cells[0].Value.ToString(); sql = \ where 学?ì生|¨2学?ì号?lh= '\ + Sno + \; con.OperateData(sql); SetBind();

MessageBox.Show(\删|?除y成¨|功|!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch {

38

MessageBox.Show(\不?能¨1做á?该?操¨′作á??!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information);

} }

else return;

}

private void button2_Click(object sender, EventArgs e) {

string 学?ì生|¨2学?ì号?lh = dataGView.CurrentRow.Cells[0].Value.ToString();

try {

sql = \班?¨¤级?编ਤ号?lh from Studentslh where 班?¨¤级?编ਤ名?lh='\ + dataGView.CurrentRow.Cells[2].Value.ToString() + \; ds = con.Getds(sql);

string 班?¨¤级?编ਤ号?lh = ds.Tables[0].Rows[0][0].ToString(); sql = \学?ì生|¨2姓?名?lh='\ + dataGView.CurrentRow.Cells[1].Value.ToString() + \班?¨¤级?编ਤ号?lh='\

+ 班?¨¤级?编ਤ号?lh + \ where 学?ì生|¨2学?ì号?lh='\ + 学?ì生|¨2学?ì号?lh + \;

con.OperateData(sql); SetBind(); } catch {

MessageBox.Show(\不?能¨1做á?该?操¨′作á??!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information); }

}

private void btnInsert_Click(object sender, EventArgs e) { try {

sql = \ + txtSno.Text + \ +

cmbSsex.SelectedValue.ToString() + \ + txtSname.Text + \ + txtSage.Text + \ + txtSsource.Text + \ + txtScredit.Text + \ + txtSclass.Text + \; con.OperateData(sql); SetBind(); } catch

39

{

MessageBox.Show(\不?能¨1做á?该?操¨′作á??!ê?\, \提?¨¢示o?\, MessageBoxButtons.OK, MessageBoxIcon.Information); } }

private void txtSno_TextChanged(object sender, EventArgs e) {

}

private void btnCancel_Click(object sender, EventArgs e) {

this.Close(); } } }

截图:

(5)调用存储过程: 截图:

40


毕业设计 - 高校成绩管理系统数据库设计与实现(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:名词相关知识

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: