04Add.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>新增班级</title>
<style type="text/css">
#tbList {
border:1px solid #0094ff;
border-collapse:collapse;
width:300px;
margin:50px auto;
}
#tbList th,td{
border:1px solid #0094ff;
padding:5px;
}
</style>
</head>
<body>
<form method="post" action="04Add.ashx">
<table id="tbList">
<tr>
<td>班级名称:</td>
<td><input type="text" id="txtName" name="txtName"/></td>
</tr>
<tr>
<td>班级人数:</td>
<td><input type="text" id="txtCount" name="txtCount" /></td>
</tr>
<tr>
<td colspan="">
<input type="submit" value="确定" />
<input type="button" id="btnCancel" value="取消" onclick="window.location='01List.ashx'" />
</td>
</tr>
</table>
</form>
</body>
</html>

04Add.ashx

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web; namespace AspNetAshx
{
/// <summary>
/// _04Add 的摘要说明
/// </summary>
public class _04Add : IHttpHandler
{ public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/html"; //1.获取用户表单post提交的数据
string strName = HttpContext.Current.Request.Form["txtName"].Trim();
string strCount = HttpContext.Current.Request.Form["txtCount"];
//2.验证数据
if (string.IsNullOrEmpty(strName) || !CommonHelper.IsNum(strCount))
{
CommonHelper.WriteJs("对不起,您输入的数据格式错误~请仔细检查~~", "04Add.html");
}
else
{
//3.更新到数据库中
SqlParameter[] paras = {
new SqlParameter("Cname",strName),
new SqlParameter("CCount",strCount)
};
int res = SqlHelper.ExcuteNoneQuery("insert into Classes (CName,CCount) values(@Cname,@CCount)", paras);
if (res > )
{
CommonHelper.WriteJs("新增成功~!", "01List.ashx");
}
else
{
CommonHelper.WriteJs("新增失败~!如果您是美女,请联系管理员~~~qq:111111", "04Add.html");
}
}
} public bool IsReusable
{
get
{
return false;
}
}
}
}

04Add.ashx(新增班级)的更多相关文章

  1. 02Modify.ashx(修改班级信息)

    02Modify.html 修改 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> & ...

  2. 03Del.ashx(删除班级)

    03Del.ashx 数据库里定义个BOOL型,TRUE表示正常FALSE表示删除 using System; using System.Collections.Generic; using Syst ...

  3. 02Del.ashx(删除班级)

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using WebHelper ...

  4. 01List.ashx(班级列表动态页面)

    01List.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <he ...

  5. 第一套增删改查(htm+ashx完成)

    1.展示人员列表htm文件: <a href="PersonEditAddNew.ashx?action=addnew">添加</a> </p> ...

  6. 【学员管理系统】0x01 班级信息管理功能

    [学员管理系统]0x01 班级信息管理功能 写在前面 项目详细需求参见:Django项目之[学员管理系统] 视图函数: 我们把所有的处理请求相关的函数从 urls.py中拿出来,统一放在一个叫view ...

  7. Mybatis框架中实现双向一对多关系映射

    学习过Hibernate框架的伙伴们很容易就能简单的配置各种映射关系(Hibernate框架的映射关系在我的blogs中也有详细的讲解),但是在Mybatis框架中我们又如何去实现 一对多的关系映射呢 ...

  8. jqgrid定义多选操作

    先定义:    var SelectRowIndx; 然后加入以下属性: multiselect: true, onSelectRow: function () { SelectRowIndx = G ...

  9. 2014年4月份第4周51Aspx源码发布详情

    精灵豆会员管理系统源码  2014-4-21 [VS2010]功能介绍:精灵豆会员管理系统业务管理平台采用微软选进的C#语言开发,采用大型数据库,具有比较高的执行效率和高安全性.系统分为消费管理,会员 ...

随机推荐

  1. nginx反向代理压测问题记录

    使用nginx反向代理压测web程序,100个用户并发时,每隔一段时间loadrunner工具中就会报错,报错信息如下: Continuing after Error -26610: HTTP Sta ...

  2. 一种是CI(Constructor Injection)构造方法注入,另一种是SI(Set Injection) set 注入

    一:这里先说一下DI(Dependency Injection)依赖注入有种表现形式:一种是CI(Constructor Injection)构造方法注入,另一种是SI(Set Injection) ...

  3. motion的移植和使用

    说明: motion主页:http://www.lavrsen.dk/foswiki/bin/view/Motion motion下载地址:http://sourceforge.net/project ...

  4. 数据库ADO方式读取图片

    void Caccess_test_1Dlg::OnBnClickedButton3()//将偏振图像存入数据库 { // TODO: 在此添加控件通知处理程序代码 if (!PathFileExis ...

  5. HTML之DocType的几种类型

    一.什么是DOCTYPE DOCTYPE是Document Type(文档类型)的简写,在页面中,用来指定页面所使用的XHTML(或者HTML)的版本.要想制作符合标准的页面,一个必不可少的关键组成部 ...

  6. c++虚函数表 Brew VTBL

    参考:http://blog.csdn.net/haoel/article/details/1948051/ BREW VTBL:http://blog.chinaunix.net/uid-51740 ...

  7. Spring MVC异常统一处理

    package com.shzq.common.exception; import java.io.PrintWriter;import java.io.StringWriter;import jav ...

  8. 超全面的JavaWeb笔记day22<文件上传>

    文件上传概述 1 文件上传的作用 例如网络硬盘!就是用来上传下载文件的. 在智联招聘上填写一个完整的简历还需要上传照片呢. 2 文件上传对页面的要求 上传文件的要求比较多,需要记一下: 1. 必须使用 ...

  9. Messages: No result defined for action cn.itcast.oa.test.TestAction and result SUCCESS

    Struts Problem Report Struts has detected an unhandled exception: Messages: No result defined for ac ...

  10. docker学习-docker核心技术

    镜像:集装箱     ---build 仓库:超级码头  ----ship 容器:运行程序的地方    ----run docker运行一个程序的过程:去仓库把镜像拉到本地,然后用一条命令把镜像运行起 ...