本系列旨在熟悉GZFramwork数据库层操作,对数据库表进行增删改查,单据编号生成等:

详细见图:

普通单表操作:

数据库建模:

创建表脚本:

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_CustomerDetail') and o.name = 'FK_TB_CUSTO_REFERENCE_TB_CUSTO')
alter table tb_CustomerDetail
drop constraint FK_TB_CUSTO_REFERENCE_TB_CUSTO
go if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_DictionaryDetail') and o.name = 'FK_TB_DICTI_REFERENCE_TB_DICTI')
alter table tb_DictionaryDetail
drop constraint FK_TB_DICTI_REFERENCE_TB_DICTI
go if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')
where r.fkeyid = object_id('tb_EmployeeCon') and o.name = 'FK_TB_EMPLO_REFERENCE_TB_EMPLO')
alter table tb_EmployeeCon
drop constraint FK_TB_EMPLO_REFERENCE_TB_EMPLO
go if exists (select 1
from sysobjects
where id = object_id('_tmp')
and type = 'U')
drop table _tmp
go if exists (select 1
from sysobjects
where id = object_id('tb_Customer')
and type = 'U')
drop table tb_Customer
go if exists (select 1
from sysobjects
where id = object_id('tb_CustomerDetail')
and type = 'U')
drop table tb_CustomerDetail
go if exists (select 1
from sysobjects
where id = object_id('tb_Dictionary')
and type = 'U')
drop table tb_Dictionary
go if exists (select 1
from sysobjects
where id = object_id('tb_DictionaryDetail')
and type = 'U')
drop table tb_DictionaryDetail
go if exists (select 1
from sysobjects
where id = object_id('tb_EmpLeave')
and type = 'U')
drop table tb_EmpLeave
go if exists (select 1
from sysobjects
where id = object_id('tb_Employee')
and type = 'U')
drop table tb_Employee
go if exists (select 1
from sysobjects
where id = object_id('tb_EmployeeCon')
and type = 'U')
drop table tb_EmployeeCon
go if exists (select 1
from sysobjects
where id = object_id('tb_MyUser')
and type = 'U')
drop table tb_MyUser
go /*==============================================================*/
/* Table: _tmp */
/*==============================================================*/
create table _tmp (
isid int identity(1,1) not for replication,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'表公共字段',
'user', @CurrentUser, 'table', '_tmp'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', '_tmp', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', '_tmp', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', '_tmp', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', '_tmp', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', '_tmp', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_Customer */
/*==============================================================*/
create table tb_Customer (
isid int identity(1,1) not for replication,
CustomerCode varchar(20) not null,
CustomerName varchar(50) null,
Adress nvarchar(100) null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_CUSTOMER primary key (CustomerCode)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'客户',
'user', @CurrentUser, 'table', 'tb_Customer'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'客户编号',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CustomerCode'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'客户名称',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CustomerName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'地址',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'Adress'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_Customer', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_CustomerDetail */
/*==============================================================*/
create table tb_CustomerDetail (
isid int identity(1,1) not for replication,
CustomerCode varchar(20) null,
CustomerAttribute varchar(50) null,
CustomerATValue nvarchar(100) null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_CUSTOMERDETAIL primary key (isid)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'客户明细',
'user', @CurrentUser, 'table', 'tb_CustomerDetail'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'客户编号',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerCode'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'属性',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerAttribute'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'属性值',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CustomerATValue'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_CustomerDetail', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_Dictionary */
/*==============================================================*/
create table tb_Dictionary (
TypeID varchar(10) not null,
TypeName varchar(20) null,
Remark varchar(200) null,
isid int identity(1,1) not for replication,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_DICTIONARY primary key (TypeID)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'数据字典主表',
'user', @CurrentUser, 'table', 'tb_Dictionary'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'类别编号',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'TypeID'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'类别名称',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'TypeName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'备注',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'Remark'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_Dictionary', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_DictionaryDetail */
/*==============================================================*/
create table tb_DictionaryDetail (
isid int identity(1,1) not for replication,
TypeID varchar(10) null,
DataCode varchar(10) null,
DataName varchar(20) null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_DICTIONARYDETAIL primary key (isid)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'数据字典明细',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'类别编号',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'TypeID'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'编号',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'DataCode'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'字典名称',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'DataName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_DictionaryDetail', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_EmpLeave */
/*==============================================================*/
create table tb_EmpLeave (
isid int identity(1,1) not for replication,
DocNo varchar(20) not null,
EmpName varchar(20) null,
BeginDate datetime null,
EndDate datetime null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_EMPLEAVE primary key (DocNo)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'请假记录',
'user', @CurrentUser, 'table', 'tb_EmpLeave'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'请假单号',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'DocNo'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'请假人',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'EmpName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'请假开始日期',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'BeginDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'请假结束日期',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'EndDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_EmpLeave', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_Employee */
/*==============================================================*/
create table tb_Employee (
isid int identity(1,1) not for replication,
InfoID varchar(10) not null,
EmpName varchar(20) null,
Sex varchar(2) null,
Age int null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_EMPLOYEE primary key (InfoID)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'员工表',
'user', @CurrentUser, 'table', 'tb_Employee'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'员工编号',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'InfoID'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'姓名',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'EmpName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'性别',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'Sex'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'年龄',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'Age'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_Employee', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_EmployeeCon */
/*==============================================================*/
create table tb_EmployeeCon (
isid int identity(1,1) not for replication,
InfoID varchar(10) null,
ConNo varchar(10) not null,
BeginDate datetime null,
EndDate datetime null,
Salary int null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_EMPLOYEECON primary key nonclustered (ConNo)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'员工合同表',
'user', @CurrentUser, 'table', 'tb_EmployeeCon'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'员工编号',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'InfoID'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'合同编号',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'ConNo'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'合同开始日期',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'BeginDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'合同结束日期',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'EndDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'最低工资',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'Salary'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_EmployeeCon', 'column', 'LastUpdateDate'
go /*==============================================================*/
/* Table: tb_MyUser */
/*==============================================================*/
create table tb_MyUser (
isid int identity(1,1) not for replication,
Account varchar(20) not null,
UserName varchar(20) null,
PetName varchar(20) null,
CreateUser varchar(20) null,
CreateDate datetime null,
LastUpdateUser varchar(20) null,
LastUpdateDate datetime null,
constraint PK_TB_MYUSER primary key (Account)
)
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'用户表',
'user', @CurrentUser, 'table', 'tb_MyUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'自增列',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'isid'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'用户账号',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'Account'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'用户名称',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'UserName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'昵称',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'PetName'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建人',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'CreateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'创建日期',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'CreateDate'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改人',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'LastUpdateUser'
go declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'修改日期',
'user', @CurrentUser, 'table', 'tb_MyUser', 'column', 'LastUpdateDate'
go alter table tb_CustomerDetail
add constraint FK_TB_CUSTO_REFERENCE_TB_CUSTO foreign key (CustomerCode)
references tb_Customer (CustomerCode)
go alter table tb_DictionaryDetail
add constraint FK_TB_DICTI_REFERENCE_TB_DICTI foreign key (TypeID)
references tb_Dictionary (TypeID)
go alter table tb_EmployeeCon
add constraint FK_TB_EMPLO_REFERENCE_TB_EMPLO foreign key (InfoID)
references tb_Employee (InfoID)
go

本系列项目源码下载地址:https://github.com/GarsonZhang/GZFramework.Demo

系列文章

1. GZFramwork数据库层《前言》Demo简介

2. GZFramwork数据库层《前言》DLL项目引用

3. GZFramwork数据库层《一》普通表增删改查

4. GZFramwork数据库层《二》单据表增删改查(自动生成单据号码)

5. GZFramwork数据库层《三》普通主从表增删改查

6. GZFramwork数据库层《四》单据主从表增删改查(主键自动生成)

7. GZFramwork数据库层《五》高级主从表增删改查(主表明细表主键都自动生成)

8. GZFramwork数据库层《六》存储过程调用

9. GZFramwork数据库层《七》总结

GZFramwork数据库层《前言》Demo简介的更多相关文章

  1. GZFramwork数据库层《前言》DLL项目引用

    新建项目: 1. 项目引入GZFramwork.dll NuGet地址:Install-Package GZFramwork 每个项目都引用 2.BLL层 设置数据库连接维护类:继承于:GZFramw ...

  2. GZFramwork数据库层《四》单据主从表增删改查

    同GZFramwork数据库层<三>普通主从表增删改查 不同之处在于:实例 修改为: 直接上效果: 本系列项目源码下载地址:https://github.com/GarsonZhang/G ...

  3. GZFramwork数据库层《三》普通主从表增删改查

    运行结果: 使用代码生成器(GZCodeGenerate)生成tb_Cusomer和tb_CusomerDetail的Model 生成器源代码下载地址: https://github.com/Gars ...

  4. GZFramwork数据库层《二》单据表增删改查(自动生成单据号码)

    运行效果: 使用代码生成器(GZCodeGenerate)生成tb_EmpLeave的Model 生成器源代码下载地址: https://github.com/GarsonZhang/GZCodeGe ...

  5. GZFramwork数据库层《一》普通表增删改查

    运行结果:     使用代码生成器(GZCodeGenerate)生成tb_MyUser的Model 生成器源代码下载地址: https://github.com/GarsonZhang/GZCode ...

  6. 8 Django 模型层(1)--orm简介

    ORM简介 MVC或者MVC框架中包括一个重要的部分,就是ORM,它实现了数据模型与数据库的解耦,即数据模型的设计不需要依赖于特定的数据库,通过简单的配置就可以轻松更换数据库,这极大的减轻了开发人员的 ...

  7. 《转》读discuzx3.1 数据库层笔记

    最近开始在看discuzx3.1的代码,看到数据库层的实现,discuzx的数据库层能够支撑数据库分库,分布式部署,主要水平分表,也可以很方便的支持其他数据库.性能上,可以做读写分离,支持数据缓存.可 ...

  8. SAP Netweaver和Hybris的数据库层

    ABAP Netweaver 在SAP基于Netweaver的ABAP应用里,应用开发人员用Open SQL访问数据库, 这些Open SQL会被Database interface(数据库接口)转换 ...

  9. 第一章 权限管理DEMO简介

    源代码GitHub:https://github.com/ZhaoRd/Zrd_0001_AuthorityManagement 1.系列介绍 工作已有五年之久,一直有想通过博客写点自己知道的,在博客 ...

随机推荐

  1. BizTalk开发系列(二十四) BizTalk项目框架建议

    Asp.NET有MVC框架,大部份的开发都是按照MVC进行的.BizTalk是面向消息的开发,不能完全采用分层的开发模式.而微软只提供了 BizTalk项目开发的基本策略,通过分析相关的Complex ...

  2. BizTalk开发系列(七) Hello World2

    之前根据BizTalk的订阅原理,使用BizTalk管理控制台创建了第一个应用程序 Hello World.但是由于控制台的开发功能有限,绝大多数的BizTalk程序都是在集成开发环境Visual S ...

  3. BizTalk开发系列(一) "Hello World"

    学习开发语言的时候很喜欢输出“Hello World”作为第一个程序.今天我们也在BizTalk 上创建一个简单的 "Hello World" 程序. BizTalk的时候有很多文 ...

  4. NTFS 权限讲解 ACL

    节选自:Securing Windows Server 2003 4.1 Protecting Files with NTFS File Permissions The primary techniq ...

  5. lsof 一切皆文件

    Docs » 工具参考篇 » 3. lsof 一切皆文件 Docs » 工具参考篇 » 3. lsof 一切皆文件 Edit on GitHub 3. lsof 一切皆文件¶ lsof(list op ...

  6. Java虚拟机内存管理机制

    自动内存管理机制 Java虚拟机(JVM)在执行Java程序过程中会把它所管理的内存划分为若干个不同的数据区域.这些区域都有各自的用途,以及创建和销毁的时间,有的区域随着虚拟机进程的启动而存在,有的区 ...

  7. 获取唯一UUID/UDID方案

    概述 如何保证获取到的UUID能够唯一标识每一台设备呢?我们知道通过UIDevice可以获取到UUIDString,但是如果App被删除了然后重新安装,就会得到不同的UUIDString,这并不是我们 ...

  8. Spark在Yarn上运行Wordcount程序

    前提条件 1.CDH安装spark服务 2.下载IntelliJ IDEA编写WorkCount程序 3.上传到spark集群执行 一.下载IntellJ IDEA编写Java程序 1.下载IDEA ...

  9. ftp列表错误或长城宽带连不上ftp的解决方法

    有些是长城宽带,我 帮忙测试,在客户PC机上测试,PING 任何网站 不通:tracert 超时:FTP 超时,不出现用户名提示.但访问网站正常,检测后进入到路由器,禁用DHCP服务 ,问题解决. 或 ...

  10. html+css+javascript实现列表循环滚动示例代码

    使用html+css+javascript实现列表循环滚动,设置时间定时,在规定的时间内替换前一个节点的内容,具体示例如下,感兴趣的朋友可以参考下 说明:设置时间定时,在规定的时间内替换前一个节点的内 ...