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. imx6 读取CPU温度

    imx6 读取CPU温度 cat /sys/class/thermal/thermal_zone0/temp Tony Liu 2017-2-11, Shenzhen

  2. php -- PHP在linux上执行外部命令,system(),exec(),shell_exec()

    目录:一.PHP中调用外部命令介绍二.关于安全问题三.关于超时问题四.关于PHP运行linux环境中命令出现的问题 一.PHP中调用外部命令介绍 在PHP中调用外部命令,有三种方法: 1. 调用专门函 ...

  3. 【Java 线程的深入研究1】Java 提供了三种创建线程的方法

    Java 提供了三种创建线程的方法: 通过实现 Runnable 接口: 通过继承 Thread 类本身: 通过 Callable 和 Future 创建线程. 1.通过实现 Runnable 接口来 ...

  4. php date strtotime的用法

    1.上个月第一天及最后一天. echo date('Y-m-01', strtotime('-1 month')); echo strtotime(date('Y-m-01 0:00:00', str ...

  5. is_file,is_dir,file_exists

    is_file()和file_exists()效率比较,结果当文件存在时,is_file函数比file_exists函数速度快14倍,当文件不存在时,两者速度相当.同理,当文件目录存在时,is_dir ...

  6. c++ 在线编译

    #include <algorithm> #include <cstdlib> #include <fstream> #include <iostream&g ...

  7. SharePoint 2013 workflow cannot start automatically when you logged in site as a system account

    I have created one simple workflow on custom list using SharePoint designer 2013.While designing wor ...

  8. python中 decimal不能直接应用于float数据

    今天将程序部署到linux服务器上,出现很奇怪的现象. 在windows上运行正常的decimal,到了linux环境下不能正常运行,报出下面的错误. 代码为: income = get_dashbo ...

  9. 【java】java设计模式(5):原型模式(Prototype)

    原型模式虽然是创建型的模式,但是与工程模式没有关系,从名字即可看出,该模式的思想就是将一个对象作为原型,对其进行复制.克隆,产生一个和原对象类似的新对象.本小结会通过对象的复制,进行讲解.在Java中 ...

  10. Javascript中的感叹号和函数function

    js函数前加分号和感叹号是什么意思?有什么用?:http://www.cnblogs.com/mq0036/p/4605255.html function与感叹号:https://swordair.c ...