您的位置:首页 > 运维架构 > 网站架构

三层架构实现增删的简单实例

2012-05-29 10:10 316 查看
首先建一个web.config的窗体,添加
<appSettings>
<add key="conn" value="server=.;database=test;integrated security=true"/>
</appSettings>
<connectionStrings/>字段


简单页面设计:

显示层

Bll.Bll_class BC;
protected void Page_Load(object sender, EventArgs e)
{
BC = new BLL.BLL_Class();
this.GridView1.DataSource = BC.Bind();
this.GridView1.DataBind();
}
//添加
protected void Button1_Click(object sender, EventArgs e)
{
BC.ID = Convert.ToInt32(TextBox1.Text.Trim().ToString());
BC.Age = Convert.ToInt32(TextBox2.Text);
BC.Name = this.TextBox4.Text;
BC.Sex = this.TextBox3.Text;
BC.Insert_info();
}
删除
protected void Button2_Click(object sender, EventArgs e)
{
BC.Sid = Convert.ToInt32(TextBox1.Text.Trim().ToString());
BC.Delete_info();
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐