日期:2014-05-17 浏览次数:20646 次
剩下的就是C#代码什么展现出来了
---表结构:
Employee(EmplNo,EmplName,PositionNo,Enabled)
Position(PositionNo,Name,Enabled)
--查询
select EmplNo,EmplName,b.Name as PositionName
from Employee a
inner join Position b on a.PositionNo=b.PositionNo
order by a.PositionNo
--请参考
/****** Object: Table [dbo].[HR_Org] Script Date: 10/30/2013 08:22:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[HR_Org](
[Org_Id] [int] IDENTITY(1,1) NOT NULL,
[Org_Pid] [int] NOT NULL,
[Org_No] [varchar](10) NOT NULL,
[Org_Name] [varchar](100) NOT NULL,
[Org_Name_En] [varchar](100) NOT NULL,
[Org_Level] [tinyint] NOT NULL,
[Is_Enabled] [bit] NOT NULL,
[Sort_Id] [int] NOT NULL,
[Is_Company] [bit] NOT NULL,
[Org_Manager] [varchar](200) NOT NULL,
[Update_User] [varchar](20) NOT NULL,
[Update_Date] [datetime] NOT NULL,
CONSTRAINT [PK_HR_Org] PRIMARY KEY CLUSTERED
(
[Org_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'组织ID号(主键)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HR_Org', @level2type=N'COLUMN',@level2name=N'Org_Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上级组织编号(根节点为0)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HR_Org', @level2type=N'COLUMN',@level2name=N'Org_Pid'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'组织编号' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HR_Org', @level2type=N'COLUMN',@level2name=N'Org_No'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'组织名称(唯一索引)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N