不写一行代码,实现单表增删改查(附demo)

   接着昨天的博客 零代码配置xml维护单表 ,今天上午上班啥事没做也没啥事做,一心想接着昨天的文章搞一个简单版的demo,然后就整理出了这么个阉割版本的demo,在这个版本中,去掉了分层和自定义控件扩展,sql操作代码也放在了页面中,有兴趣的可以看昨天那篇文章自行扩展。

   demo结构目录如下:

 

  crud操作在于三个页面commonAdd.aspx(添加页),commonEdit.aspx(编辑查看页),commonQuery.aspx(列表页),另外加一个配置文件config.xml

,config.xml文件对应了数据库建立的表配置,另外app_code/t_column.cs是对xml表配置实体的一个封装,每个配置信息代表什么意思,里面都已经注释了

     数据库放在app_data里面,自己还原

   下面对demo作简单介绍:

   1.建立数据库:(偷个懒,列直接用中文了)

配置xml

 

 1  <? xml version="1.0" encoding="utf-8"  ?>
 2  < root >
 3     < table  id ="1"  key ="id"  name ="t_demo"  cnname ="测试演示"  order ="addtime desc" >
 4       < column  name ="id"  cnname ="编号"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="n"  regex =""  tip =""  type ="key" ></ column >
 5       < column  name ="姓名"  cnname ="姓名"  ftable =""  fvalue =""  ftext =""  isfilter ="y"  visible ="y"  allownull ="n"  regex =""  tip ="姓名必须填写哦!"  type ="textbox" ></ column >
 6       < column  name ="性别"  cnname ="性别"  ftable ="t_sex"  fvalue ="id"  ftext ="name"  isfilter ="n"  visible ="y"  allownull ="n"  regex =""  tip =""  type ="dropdownlist" ></ column >
 7       < column  name ="年龄"  cnname ="年龄"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="n"  regex ="^\d+$"  tip =""  type ="textbox" ></ column >
 8       < column  name ="出生日期"  cnname ="出生日期"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="n"  allownull ="y"  regex ="^\d{4}-\d{1,2}-\d{1,2}$"  tip =""  type ="textbox" ></ column >
 9       < column  name ="个人简介"  cnname ="个人简介"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="mtextbox" ></ column >
10       < column  name ="技能描述"  cnname ="技能描述"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="mtextbox" ></ column >
11       < column  name ="语言"  cnname ="语言"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
12       < column  name ="国家"  cnname ="国家"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
13       < column  name ="省"  cnname ="省"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
14       < column  name ="市"  cnname ="市"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
15       < column  name ="家庭地址"  cnname ="家庭地址"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
16       < column  name ="兴趣爱好"  cnname ="兴趣爱好"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="mtextbox" ></ column >
17       < column  name ="qq"  cnname ="qq"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
18       < column  name ="msn"  cnname ="msn"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="y"  regex =""  tip =""  type ="textbox" ></ column >
19       < column  name ="addtime"  cnname ="时间"  ftable =""  fvalue =""  ftext =""  isfilter ="n"  visible ="y"  allownull ="n"  regex =""  tip =""  type ="autodatetime" ></ column >
20     </ table >
21  </ root >

 

 

运行default.aspx,直接跳转到commonquery.aspx?id=1

 

 

点击添加按钮

 

 

点击编辑按钮

 

 

点击删除按钮

 

 

点击查看链接

 

 

 demo.rar

/Files/leonwang/db.rar 

 

转载于:https://www.cnblogs.com/leonwang/archive/2010/01/22/1653965.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值