使用三层实现页面中输入学生id,单机按钮后使该学生的年龄加
2012-12-10 08:57
369 查看
UI层
前台
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
请输入学生的Id:<asp:TextBox ID="txtid" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Xonclick="Button1_Click" Text="该学生的年龄加1"
Width="263px" />
</div>
</form>
</body>
</html>
后台
namespace ASP绑定控件.UI
{
public partial class ui1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int fid = Convert.ToInt32(txtid.Text.Trim());
MyStudentsBll bll = new MyStudentsBll();
bool b= bll.AgeAddById(fid);
if (b == true)
{
Response.Write("修改成功!");
}
else
{
Response.Write("修改失败!");
}
}
}
}
DAL层
namespace ASP绑定控件.DAL
{
public class MyStudentsDal
{
public int AgeAddById(int Fid)
{
string sql = "update MyStudents set FAge=FAge+1 where FId=@id";
SqlParameter pms = new SqlParameter("@id", Fid);
return sqlHealpler.sqlHealper.ExecturNonQuery(sql, pms);
}
}
}
Bll层
namespace ASP绑定控件.Bll
{
public class MyStudentsBll
{
public bool AgeAddById(int fid)
{
MyStudentsDal dal = new MyStudentsDal();
int r= dal.AgeAddById(fid);
if (r > 0)
{
return true;
}
else
{
return false;
}
}
}
}
前台
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
请输入学生的Id:<asp:TextBox ID="txtid" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Xonclick="Button1_Click" Text="该学生的年龄加1"
Width="263px" />
</div>
</form>
</body>
</html>
后台
namespace ASP绑定控件.UI
{
public partial class ui1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int fid = Convert.ToInt32(txtid.Text.Trim());
MyStudentsBll bll = new MyStudentsBll();
bool b= bll.AgeAddById(fid);
if (b == true)
{
Response.Write("修改成功!");
}
else
{
Response.Write("修改失败!");
}
}
}
}
DAL层
namespace ASP绑定控件.DAL
{
public class MyStudentsDal
{
public int AgeAddById(int Fid)
{
string sql = "update MyStudents set FAge=FAge+1 where FId=@id";
SqlParameter pms = new SqlParameter("@id", Fid);
return sqlHealpler.sqlHealper.ExecturNonQuery(sql, pms);
}
}
}
Bll层
namespace ASP绑定控件.Bll
{
public class MyStudentsBll
{
public bool AgeAddById(int fid)
{
MyStudentsDal dal = new MyStudentsDal();
int r= dal.AgeAddById(fid);
if (r > 0)
{
return true;
}
else
{
return false;
}
}
}
}
相关文章推荐
- 使用三层架构,实现页面中输入学生id,单机按钮后使该学生的年龄加
- 实现页面中输入学生id,单机按钮后使该学生的年龄加。(使用三层—)
- 12-3 用三层实现 页面中输入学生id,单机按钮后使该学生的年龄加。
- 运用三层架构来输入学生id使年龄加1
- 制作login.jsp页面,要求实现提供用户登陆的界面, 用户通过该界面输入用户名(控件名userName)和密码(控件名password), 然后点击“登录”按钮实现登陆操作.
- 1怎样让输入的text文本填写的部分只添加数字、2怎样将输入的数字一次性全部删除 3怎样选择密码 让它不显示 4 怎样实现在没有return的情况下点击button的情况下就能够使键盘页面下落5 怎样实现点击指定的button来对使指定的text进行键盘弹出 6怎样改变button按钮的状态
- velocity页面下,使用jQuery实现点击添加按钮添加一行输入框
- 使用pushState实现微信“返回”按钮控制单页应用页面的无刷新跳转
- mac 上使用ssh-copy-id 上传公钥 实现不输入密码登录
- js:页面多处输入只使用一个验证码/获得焦点显示/onblur隐藏实现
- 利用5个标签,4个文本框,2个按钮,自己设计布局实现输入三边求三角形面积。界面如下所示。三角形类的编写可以使用实验4中已经写过的三角形类,当点击“判断三边”时,若能构成三角形,在标签5上显示“可以构成三角形!”,如不能构成三角形,在标签5上显示“不能构成三
- [JavaScript]使用JavaScript+CSS实现注册页面中检验两次密码输入是否相同
- 黑马程序员之WinForm编程基础学习笔记:页面上有一张图片,默认是隐藏的,用户在文本框中输入身份证号(131226198105223452),点击按钮,如果年龄大于18岁则显示图片。
- android端和pc端使用usb进行socket通信,其中android是服务器端,pc是客户端。如何实现安卓端输入的数据通过按钮发送到pc端?
- 基于BootStrap的Metronic框架实现页面链接收藏夹功能按钮移动收藏记录(使用Sortable进行拖动排序)
- repeater实现样式设置,并添加删除按钮,参考课上老师做的案例。数据表添加字段status,使用repeater实现禁用与启用。repeater添加编辑按钮,和Edit.aspx页面。
- 使用pushState实现微信“返回”按钮控制单页应用页面的无刷新跳转
- [Unity3D]手机3D游戏开发:如何实现最高分的存储与显示(七)----使用Game ID避免数据重复输入
- 输出学生成绩。本题要求编写程序,根据输入学生的成绩,统计并输出学生的平均成绩、最高成绩和最低成绩。建议使用动态内存分配来实现。
- 如何使用存储过程实现WEB页面的审批按钮作用