资源简介
ASP.NET学生管理系统 对sql server数据库的增删改查 有教师管理界面和学生成绩查询和选课界面

代码片段和文件信息
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class AddClass : System.Web.UI.Page
{
protected void Page_Load(object sender EventArgs e)
{
if (!Page.IsPostBack)
{
MyDataBind();
}
}
private void MyDataBind()
{
String classid = Request[“classid“];
String teacherId = Request[“teacherId“];
String userNumber = ““;
String score = “0“;
String className = Request[“className“];
//设置连接字符串
string connstr = “server=B204-21\\SQL2008;;Integrated Security=true;database= StudentDB “;
//创建Connection对象
SqlConnection conn = new SqlConnection(connstr);
try
{
if (Request.Cookies[“login“] == null || Request.Cookies[“login“][“userNumber“] == ““) //两个位置顺序不可换 在未登录情况下报空指针
{
Response.Write(“ yle=‘ position:absolute; top:50%;left:50%; margin:-100px 0 0 -150px; width:300px; height:200px;z-index:99; ‘>请登录后再查询! “);
}
else
{
userNumber = Request.Cookies[“Login“][“userNumber“];
conn.Open();
String sqlQuery = “select * from StudentCourse where studentNumber = “ + userNumber + “and classId=“ + classid;
SqlCommand cmd1 = new SqlCommand(sqlQuery conn);
SqlDataReader reader = cmd1.ExecuteReader();
if (!reader.Read())
{
reader.Close();//必须先关闭 否则资源抢占报错
String sql = “insert into StudentCourse (studentNumberclassIdscoreteacherId) values(“ + userNumber + ““ + classid + ““ + score + ““ + teacherId + “)“;
SqlCommand cmd = new SqlCommand(sql conn);
int ret = (int)cmd.ExecuteNonQuery();
if (ret > 0)
{
Response.Write(“ yle=‘ position:absolute; top:50%;left:50%; margin:-100px 0 0 -150px; width:300px; height:200px;z-index:99; ‘>添加课程:“ + className + “成功! “);
}
else
{
Response.Write(“ yle=‘ position:absolute; top:50%;left:50%; margin:-100px 0 0 -150px; width:300px; height:200px;z-index:99; ‘>操作有误,添加失败! “);
}
}
else
{
Response.Write(“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-14 11:40 StudentStystem\
文件 137 2017-05-19 10:36 StudentStystem\AddClass.aspx
文件 3621 2017-06-07 16:28 StudentStystem\AddClass.aspx.cs
文件 76800 2017-05-19 11:50 StudentStystem\B2CSystem.v11.suo
文件 2145 2017-06-14 09:28 StudentStystem\ChooseClass.aspx
文件 2348 2017-06-07 16:23 StudentStystem\ChooseClass.aspx.cs
目录 0 2017-06-14 11:40 StudentStystem\CSS\
文件 7873 2017-06-14 10:07 StudentStystem\CSS\FrontPage.css
文件 719 2015-07-23 13:29 StudentStystem\CSS\Products.css
文件 2166 2017-06-14 10:06 StudentStystem\FrontPage.master
文件 1354 2017-06-07 16:49 StudentStystem\FrontPage.master.cs
目录 0 2017-06-14 11:40 StudentStystem\Images\
文件 498 2017-05-18 17:09 StudentStystem\Images\add.png
文件 161820 2017-04-19 21:19 StudentStystem\Images\android.png
文件 119433 2016-11-19 14:47 StudentStystem\Images\C.png
文件 89420 2017-04-19 21:47 StudentStystem\Images\C1.png
文件 146900 2017-04-19 21:27 StudentStystem\Images\else.png
文件 117088 2016-11-19 14:47 StudentStystem\Images\HTML.png
文件 61486 2017-04-20 08:46 StudentStystem\Images\JAVA.png
文件 186840 2016-11-19 14:47 StudentStystem\Images\JS.png
文件 11050 2017-06-14 10:24 StudentStystem\Images\new.jpg
文件 110233 2016-11-19 14:47 StudentStystem\Images\shujujiegou.png
文件 60342 2017-04-19 21:52 StudentStystem\Images\soft.png
文件 260233 2016-11-19 14:47 StudentStystem\Images\SQL.png
文件 130610 2017-04-19 21:23 StudentStystem\Images\suanfa.png
文件 51712 2017-06-14 10:26 StudentStystem\Images\Thumbs.db
目录 0 2017-06-14 11:40 StudentStystem\JS\
文件 814 2015-07-23 13:29 StudentStystem\JS\clock.js
文件 1844 2017-06-14 10:31 StudentStystem\ManagerFrontPage.master
文件 1227 2017-06-02 20:31 StudentStystem\ManagerFrontPage.master.cs
文件 4694 2017-06-03 16:26 StudentStystem\ManagerPage.aspx
............此处省略21个文件信息
- 上一篇:C#黑白棋游戏
- 下一篇:Asp.Net版微信公众号开发源码Demo_90.rar
相关资源
- Asp.net学生信息管理系统源码
- asp.net C#购物车源代码
- ASP.NET实验室预约管理系统
- 020ASP.NET车辆综合管理系统.zip
- c# 高校档案信息管理系统
- asp.net中c#做的躲避小游戏,希望大家
- ASP.NET C# 工资管理系统
- ASP.NET客户管理系统(毕业设计 C#
- 在线求职系统(C#ASP.NET源码)
- asp.net 在线考试系统及论文
- ASP.Net文件上传管理源码
- 《OA企业办公自动化》asp.net 源码(附
- asp.netc#开发规范
- asp.net 大文件上传(带进度条)
- 通过程序自动填充并提交ASP.NET表单(
- ASP.NET 基础编程文档(PPT电子教案)
-
ASP.NET_xm
l深入编程技术 - asp.net 新闻发布系统源码(附文档以及
- asp.net 简单的Ajax应用
- asp.net 企业官网源码(附数据库)
- asp.net 花语花店销售网站源码(含数据
- ASP.NET资产管理系统源码(附数据库)
- ajax 登录(基于asp.net)
- asp.net 简单新闻发布系统源码(附数据
- asp.net新闻发布系统(源码+数据库+论
- asp.net网上购物系统源码
- RDLC报表使用
- ASP.NET 在浏览器中预览文件
- asp.net 生命周期
- asp.net 花语花店销售网站源码(附数据
评论
共有 条评论