2.概要设计
2.1 系统模块设计如下图图3所示:
学生信息管理系统 学籍管理 课程管理 成绩管理 图3
密码管理 查询管理
2.2 数据库设计
数据库设计包括数据库需求分析、数据库概念设计和数据库物理设计。数据库设计的目的,是为信息系统在数据库服务器上建立一个理想的数据模型。 2.3 数据库物理设计
数据库物理设计是指设计出数据库的物理数据模型,它是数据库在物理设备上的具体实现,即数据库服务器物理空间上的表空间、表、字段、索引、视图、储存过程、触发器,以及相应的数据字典的设计。
(1)学生学籍表(STUDENTS):
(2)课程信息表(course):
(3)成绩表(score):
5
(4)用户表(users):
3.详细设计:
3.1数据库连接配置
3.1.1web.config配置:
3.1.2在程序中读取web.config配置读取文档中的数据库设置信息,只要使用如下语句即可,语句如下:
SqlConnection conn=new SqlConnection(ConfigurationManager.ConnectionStrings[\SqlCommand cmd = new SqlCommand(sql, conn); conn.Open();
Data
Source=.;Initial
6
3.2 关键步骤和代码
3.2.1学生登录首页
具体代码和权限如下:
protected void Button1_Click(object sender, EventArgs e)
{
string userid = txtName.Text.Trim(); string userpwd = txtPwd.Text.Trim(); if (userid == \)
{
ClientScript.RegisterStartupScript(this.GetType(), \用户名为空\, \language='javascript'> alert('用户名不能为空!')\); return;
}
if (userpwd == \)
{
ClientScript.RegisterStartupScript(this.GetType(), \密码为空\, \
language='javascript'> alert('密码不能为空!')\);
return;
}
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings[\].ToString());
7
string sql = string.Format(\count(*) from users where userid='{0}' and userpwd='{1}'\, userid,
userpwd);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
int count = (int)cmd.ExecuteScalar(); Session[\] = userid;
conn.Close();
if (count > 0) //半段执行成功跳转页面
{
Response.Redirect(\);
}
else //否则 客户端提示并清空文本框
{
ClientScript.RegisterStartupScript(this.GetType(), \无此用户\, \language='javascript'> alert('对不起!')\); txtName.Text = \; txtPwd.Text = \;
} }
//取消按钮事件:清空文本框
protected void Button2_Click(object sender, EventArgs e)
{
txtName.Text = \; txtPwd.Text = \;
} }
8
3.2.2学生查询页面
具体查询代码如下: using System;
using System.Collections;
using System.Configuration; using System.Data; using System.Linq; using System.Web;
using System.Web.Security; using System.Web.UI;
using System.Web.UI.HtmlControls; using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient;
public partial class select : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
9
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库net学生信息系统项目设计报告(2)在线全文阅读。
相关推荐: