学生管理系统实训报告超详细文档格式.docx

上传人:b****1 文档编号:1203581 上传时间:2023-04-30 格式:DOCX 页数:25 大小:2.49MB
下载 相关 举报
学生管理系统实训报告超详细文档格式.docx_第1页
第1页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第2页
第2页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第3页
第3页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第4页
第4页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第5页
第5页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第6页
第6页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第7页
第7页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第8页
第8页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第9页
第9页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第10页
第10页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第11页
第11页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第12页
第12页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第13页
第13页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第14页
第14页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第15页
第15页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第16页
第16页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第17页
第17页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第18页
第18页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第19页
第19页 / 共25页
学生管理系统实训报告超详细文档格式.docx_第20页
第20页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

学生管理系统实训报告超详细文档格式.docx

《学生管理系统实训报告超详细文档格式.docx》由会员分享,可在线阅读,更多相关《学生管理系统实训报告超详细文档格式.docx(25页珍藏版)》请在冰点文库上搜索。

学生管理系统实训报告超详细文档格式.docx

+username+"

'

andPwdword='

+userpwd+"

;

SqlConnectionconn=newSqlConnection("

server=.;

database=asstu;

uid=sa;

pwd=123"

);

conn.Open();

SqlCommandcmd=newSqlCommand(strsql,conn);

intres=(int)cmd.ExecuteScalar();

if(res>

0)

MessageBox.Show("

登录成功"

frmMainmf=newfrmMain();

mf.Show();

}

else

用户名、密码非法,再想想!

对注册按钮代码进行编写:

privatevoidbtnReg_Click(objectsender,EventArgse)

stringusername=this.txtLoginName.Text;

stringuserpwd=this.txtLoginPwd.Text;

stringstrcon="

database=asstu;

SqlConnectionsqlcon=newSqlConnection(strcon);

sqlcon.Open();

stringstrsql="

insertintologintablevalues('

+username+"

'

+userpwd+"

)"

SqlCommandcmd=newSqlCommand(strsql,sqlcon);

intresult=cmd.ExecuteNonQuery();

if(result>

0)

MessageBox.Show("

注册成功,亲!

else

注册失败,亲!

txtLoginName.Text=txtLoginPwd.Text="

}

2,建立frmMain.cs窗体:

添加MenuStrip,ToolStrip控件

对“添加用户信息”进行代码编写实现窗体跳转;

privatevoid添加信息ToolStripMenuItem_Click(objectsender,EventArgse)

mainFormfrm=newmainForm();

frm.MdiParent=this;

frm.Show();

同时绑定“用户信息添加”的click事件

对“用户信息修改进行代码编写实现窗体跳转:

privatevoid用户信息修改ToolStripMenuItem_Click(objectsender,EventArgse)

frmSlectfrm=newfrmSlect();

frm.MdiParent=this;

}

同时绑定“学生信息管理”的click事件:

3,建立mainForm.cs窗体,添加如截图所示的GroupBox容器,Label标签,Button按钮,TextBox控件,RadioButton,DateTimePicker控件,并设置好文字:

对“添加”按钮进行代码编写:

privatevoidbutton1_Click(objectsender,EventArgse)

stringpstusex="

if(rbtM.Checked)

pstusex=rbtM.Text;

pstusex=radioButton2.Text;

stringstrsql=@"

INSERTINTO[asStu].[dbo].[StuInfo]

([StudentID]

[StudentName]

[StudentSex]

[StudyDate]

[DepartName]

[classname]

[StudentIDCard]

[Address]

[StudentTel]

[ExtendField]

VALUES

('

+txtStuID.Text+"

'

+txtStuName.Text+"

+pstusex+"

+dateTimePicker1.Text+"

+cboDepartName.Text+"

+cboClassName.Text+"

+txtStuIDCard.Text+"

+txtAddress.Text+"

+txtStuTel.Text+"

+txtExField.Text+"

SqlCommandcmd=newSqlCommand(strsql,sqlcon);

intresult=cmd.ExecuteNonQuery();

添加成功,亲!

sqlcon.Close();

4,建立frmSlect.cs窗体,添加GroupBox容器,DataGridView控件,三个Button按钮:

 

对“查询”按钮进行代码编辑:

select*fromstuinfo"

SqlDataAdapteradp=newSqlDataAdapter(cmd);

DataSetds=newDataSet();

adp.Fill(ds);

dgvStudent.DataSource=ds.Tables[0];

对“修改”按钮进行代码编辑:

privatevoidbutton2_Click(objectsender,EventArgse)

frmUpdatefrm=newfrmUpdate();

if(dgvStudent.SelectedRows.Count<

=0)

请先选定修改行!

return;

frm.txtStuID.Text=dgvStudent.SelectedRows[0].Cells[1].Value.ToString();

frm.txtStuName.Text=dgvStudent.SelectedRows[0].Cells[2].Value.ToString();

if(this.dgvStudent.SelectedRows[0].Cells[3].Value.ToString().Trim()=="

男"

frm.rbtM.Checked=true;

frm.rbtW.Checked=true;

frm.dbtStudyDate.Text=dgvStudent.SelectedRows[0].Cells[4].Value.ToString();

frm.cboDepartName.Text=dgvStudent.SelectedRows[0].Cells[5].Value.ToString();

frm.cboClassName.Text=dgvStudent.SelectedRows[0].Cells[6].Value.ToString();

frm.txtStuIDCard.Text=dgvStudent.SelectedRows[0].Cells[7].Value.ToString();

frm.txtStuTel.Text=dgvStudent.SelectedRows[0].Cells[8].Value.ToString();

frm.txtStuID.Enabled=false;

对“删除”按钮进行代码编辑:

privatevoidbutton3_Click(objectsender,EventArgse)

if(dgvStudent.SelectedRows.Count!

=1)

请选择删除行"

stringstuid=dgvStudent.SelectedRows[0].Cells[1].Value.ToString();

DELETEFROM[asStu].[dbo].[StuInfo]WHEREstudentID='

+stuid+"

删除成功!

删除失败!

4,建立frmUpdate.cs窗体,添加如截图所示的GroupBox容器,Label标签,Button按钮,TextBox控件,RadioButton,DateTimePicker控件,并设置好文字:

pstusex=rbtM.Text;

pstusex=rbtW.Text;

UPDATE[asstu].[dbo].[stuinfo]

SET[studentid]='

[studentname]='

[studentsex]='

[studydate]='

+dbtStudyDate.Text+"

[departname]='

[classname]='

+cboClassName.Text+"

[studentidcard]='

+txtStuIDCard.Text+"

[address]='

[studentTel]='

[extendfield]='

WHEREstudentID='

SqlCommandcmd=newSqlCommand(strsql,sqlcon);

修改成功!

修改失败!

6,运行测试

1,注册用户

2,登录用户

3,自动跳转到

4,添加用户信息

5.添加用户成功

6,点击“用户信息添加”跳转到下一窗体,点击“查询”,显示添加信息

7,点击“修改”,自动跳转到下一窗体

8,点击“删除”,成功

三,学生管理系统完成。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2