第一范文网 - 专业文章范例文档资料分享平台

学生管理系统实习报告模板

来源:用户分享 时间:2025/5/25 16:08:49 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

图4.3.5 修改信息窗口

图4.3.6 删除信息提示

图4.3.7 添加信息窗口

11

第五章 主要功能模块代码

5.1 公共类代码设计

namespace MySql {

public class mySql {

public String connectionString = @\学习\\C#\\课程设计\\StuScoreManSystem\\StuScoreManSystem\\StuScoManSys.mdf;

Integrated Security=True;Connect Timeout=30;User Instance=True;\ public String commondText;

public bool flag; //指示有条该条记录 public System.Data.DataView table;

public void runSql() // 执行查询、删除SQL语句 {

using (SqlConnection connection = new SqlConnection(connectionString)) {

connection.Open();

SqlCommand cmdQuery = new SqlCommand(commondText, connection);

SqlDataAdapter sda = new SqlDataAdapter(commondText, connection); DataSet ds = new DataSet(); sda.Fill(ds);

if (commondText.IndexOf(\ {

table = ds.Tables[0].DefaultView; }

connection.Close(); } }

public bool getFlag() //判断是否有该条记录 {

using (SqlConnection connection = new SqlConnection(connectionString)) {

connection.Open();

SqlCommand cmdQuery = new SqlCommand(commondText,

12

connection);

SqlDataReader reader = cmdQuery.ExecuteReader(); if (reader.Read()) flag = true; else flag = false; reader.Close(); connection.Close(); return flag; } }

public String getContent(String require,String SNO) //获取视图表的的指定单元格内容

{

try {

commondText = \学号=\

if (require == \课程名称\

commondText = \课程名称 FROM detail WHERE 学号=\

if (require == \成绩\

commondText = \成绩 FROM detail WHERE 学号=\SNO;

SqlDataAdapter sda = new SqlDataAdapter(commondText, connectionString);

DataSet ds = new DataSet(); sda.Fill(ds); String result=\

if(require==\课程名称\成绩\ {

int i=new int();

for (i=0; i

result = result+ds.Tables[0].Rows[i][require].ToString()+\ } } else

result=ds.Tables[0].Rows[0][require].ToString().Trim(); return result; }

catch {

return \无\ }

13

}

public void update() {//添加、更新语句 try {

using (SqlConnection connection = new SqlConnection(connectionString)) {

connection.Open();

SqlCommand cmdInsert = new SqlCommand(commondText, connection);

cmdInsert.ExecuteNonQuery(); connection.Close();

} }

catch(Exception ex) {

MessageBox.Show(ex.ToString(), \提示\ } }

}

}

5.2 登录界面代码设计

private void login_Click(object sender, EventArgs e) {//用户名及密码组合判断

if (username.Text.ToString().Trim() != \&& password.Text.ToString().Trim() != \

{

mySql sql = new mySql();

sql.commondText = %username.Text.ToString().Trim() + \\

try {

bool temp = new bool(); temp = sql.getFlag(); if (temp)

14

搜索更多关于: 学生管理系统实习报告模板 的文档
学生管理系统实习报告模板.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1f2cw534l379c974hv03_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top