asp.net-N层代码示例
一、数据库Test,
表:
createtableCustomers
(
CustIdintIDENTITY(1,1)primarykey,
CustNamevarchar(20)notnull,
Addressvarchar(50),
Linkmanvarchar(20)
)
//insertintoCusomersvalues(''ggg'',''xuzhou'',''zhangsan'');
二、配置文件
web.config
xmlversion="1.0"?>
三、业务实体
1usingSystem;
2usingSystem.Collections.Generic;
3usingSystem.Text;
4
5namespacecom.Model
6{
7/**////
8///业务实体CustomerInfo
9/// 10[Serializable]
11publicclassCustomerInfo
12{
13
14/**////
15///默认的构造函数
16/// 17publicCustomerInfo(){}
18
19/**////
20///有参数的构造函数
21/// 22///
客户号
23///客户名称
24///客户地址
25///联系人
26publicCustomerInfo(intcustId,stringcustName,stringaddress,stringlinkman)
27{
28
29this.custId=custId;
30this.custName=custName;
31this.address=address;