OleDbConnection.GetOleDbSchemaTable(
OleDbSchemaGuid.Tables, new object [] {null,null,"t_user"});看看那个返回的表,我记得有备注的

解决方案 »

  1.   

    在表上点击生成SQL脚本,在Fomatting选项卡的 Including extended properties,它会将注释也生成SQL语句,如:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_GroupManagers_Groups]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[GroupManagers] DROP CONSTRAINT FK_GroupManagers_Groups
    GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_GroupModules_Groups]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[GroupModules] DROP CONSTRAINT FK_GroupModules_Groups
    GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_GroupTypes_Groups]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[GroupTypes] DROP CONSTRAINT FK_GroupTypes_Groups
    GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_GroupUsers_Groups]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
    ALTER TABLE [dbo].[GroupUsers] DROP CONSTRAINT FK_GroupUsers_Groups
    GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Groups]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table [dbo].[Groups]
    GOCREATE TABLE [dbo].[Groups] (
    [GroupID] [int] IDENTITY (1, 1) NOT NULL ,
    [GroupName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
    [GroupDesc] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
    [CanAlter] [bit] NULL ,
    [IsActive] [bit] NULL 
    ) ON [PRIMARY]
    GO
    exec sp_addextendedproperty N'MS_Description', N'是否能修改', N'user', N'dbo', N'table', N'Groups', N'column', N'CanAlter'
    GO
    exec sp_addextendedproperty N'MS_Description', N'组描述', N'user', N'dbo', N'table', N'Groups', N'column', N'GroupDesc'
    GO
    exec sp_addextendedproperty N'MS_Description', N'用户组ID', N'user', N'dbo', N'table', N'Groups', N'column', N'GroupID'
    GO
    exec sp_addextendedproperty N'MS_Description', N'组名称', N'user', N'dbo', N'table', N'Groups', N'column', N'GroupName'
    GO
    exec sp_addextendedproperty N'MS_Description', N'是否可用', N'user', N'dbo', N'table', N'Groups', N'column', N'IsActive'
    GO
      

  2.   

    具体的信息应该是存在 sysproperties 表中