第100篇博文纪念 | C# 根据数据库表结构生成DOC数据库文档(2)-阿里云开发者社区

开发者社区> 数据库> 正文

第100篇博文纪念 | C# 根据数据库表结构生成DOC数据库文档(2)

简介:

代码说明:
这里是获取数据库2000元数据的类,如果其他数据库可参照文章1。
2.2  ColumnInfo.cs
 

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
///ColumnInfo 的摘要说明
/// </summary>
public class ColumnInfo
{
    
public ColumnInfo()
    {
        
//
        
//TODO: 在此处添加构造函数逻辑
        
//
    }

    
/// <summary>
    
/// 列名
    
/// </summary>
    public string Name { getset; }
    
/// <summary>
    
/// 数据类型
    
/// </summary>
    public string DataType { getset; }
    
/// <summary>
    
/// 长度
    
/// </summary>
    public int Length { getset; }
    
/// <summary>
    
/// 是否允许空
    
/// </summary>
    public bool Nullable { getset; }
    
/// <summary>
    
/// 1 标识
    
/// </summary>
    public int Identity { getset; }
    
/// <summary>
    
/// 1 标识种子
    
/// </summary>
    public int IdentitySeed { getset; }
    
/// <summary>
    
/// 标识增量
    
/// </summary>
    public int IdentityIncrement { getset; }
    
/// <summary>
    
/// 说明
    
/// </summary>
    public string ColumnDesc { getset; }
    
/// <summary>
    
/// 默认值
    
/// </summary>
    public string DefaultValue { getset; }

}

      代码说明:
数据库字段Model。
2.3  Default.aspx
 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<html>
<head>
    
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    
<meta name="Generator" content="Microsoft Word 11 (filtered)">
    
<title>数据库文档</title>
    
<style>
        
<!-- 
        
/* Font Definitions */ 
        @font
-face
        {
            font
-family: 宋体;
            panose
-12 1 6 0 3 1 1 1 1 1;
        }
        @font
-face
        {
            font
-family: 楷体_GB2312;
            panose
-12 1 6 9 3 1 1 1 1 1;
        }
        @font
-face
        {
            font
-family: "\@宋体";
            panose
-12 1 6 0 3 1 1 1 1 1;
        }
        @font
-face
        {
            font
-family: "\@楷体_GB2312";
            panose
-12 1 6 9 3 1 1 1 1 1;
        }
        
/* Style Definitions */p.MsoNormal, li.MsoNormal, div.MsoNormal
        {
            margin: 0cm;
            margin
-bottom: .0001pt;
            text
-align: justify;
            text
-justify: inter-ideograph;
            font
-size: 10.5pt;
            font
-family: "Times New Roman";
        }
        p.MsoFooter, li.MsoFooter, div.MsoFooter
        {
            margin: 0cm;
            margin
-bottom: .0001pt;
            layout
-grid-mode: char;
            font
-size: 9.0pt;
            font
-family: "Times New Roman";
        }
        
/* Page Definitions */@page Section1
        {
            size: 
595.3pt 841.9pt;
            margin: 
72.0pt 90.0pt 72.0pt 90.0pt;
            layout
-grid: 15.6pt;
        }
        div.Section1
        {
            page: Section1;
        }
        
-- ></style>
</head>
<body lang="ZH-CN" style='text-justify-trim: punctuation'>
    
<div class="Section1" style='layout-grid: 15.6pt'>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal" align="center" style='text-align: center'>
            
<span lang="EN-US" style='font-size: 42.0pt'>&nbsp;</span></p>
        
<class="MsoNormal" align="center" style='text-align: center'>
            
<span lang="EN-US" style='font-size: 42.0pt'>&nbsp;</span></p>
        
<class="MsoNormal" align="center" style='text-align: center'>
            
<span style='font-size: 42.0pt; font-family: 楷体_GB2312'>数据库文档</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<class="MsoNormal">
            
<span lang="EN-US">&nbsp;</span></p>
        
<div align="center">
            
<table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style='margin-left: 34.6pt;
                border-collapse: collapse; border: none'>
                <tr style='height: 15.6pt'>
                    
<td width="85" valign="top" style='width: 64.0pt; border: solid windowtext 1.0pt;
                        padding: 0cm 5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span style='font-family: 宋体'>版本号</span></p>
                    
</td>
                    
<td width="131" valign="top" style='width: 98.6pt; border: solid windowtext 1.0pt;
                        border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span style='font-family: 宋体'>日期</span></p>
                    
</td>
                    
<td width="132" valign="top" style='width: 98.65pt; border: solid windowtext 1.0pt;
                        border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span style='font-family: 宋体'>负责人</span></p>
                    
</td>
                    
<td width="132" valign="top" style='width: 98.65pt; border: solid windowtext 1.0pt;
                        border-left: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span style='font-family: 宋体'>备注</span></p>
                    
</td>
                
</tr>
                
<tr style='height: 15.6pt'>
                    
<td width="85" valign="top" style='width: 64.0pt; border: solid windowtext 1.0pt;
                        border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span lang="EN-US">0.1</span></p>
                    
</td>
                    
<td width="131" valign="top" style='width: 98.6pt; border-top: none; border-left: none;
                        border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
                        padding: 0cm 
5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span lang="EN-US">2009-9-9</span></p>
                    
</td>
                    
<td width="132" valign="top" style='width: 98.65pt; border-top: none; border-left: none;
                        border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 1.0pt;
                        padding: 0cm 
5.4pt 0cm 5.4pt; height: 15.6pt'>
                        <class="MsoNormal" align="center" style='text-align: center'>
                            
<span style='font-family: 宋体'>农民伯伯</span></p>
                    
</td>


本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/584166,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

其他文章