博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第100篇博文纪念 | C# 根据数据库表结构生成DOC数据库文档(2)
阅读量:5883 次
发布时间:2019-06-19

本文共 7208 字,大约阅读时间需要 24 分钟。

代码说明:

这里是获取数据库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 { 
get
set
; }
    
///
 
<summary>
    
///
 数据类型
    
///
 
</summary>
    
public
 
string
 DataType { 
get
set
; }
    
///
 
<summary>
    
///
 长度
    
///
 
</summary>
    
public
 
int
 Length { 
get
set
; }
    
///
 
<summary>
    
///
 是否允许空
    
///
 
</summary>
    
public
 
bool
 Nullable { 
get
set
; }
    
///
 
<summary>
    
///
 1 标识
    
///
 
</summary>
    
public
 
int
 Identity { 
get
set
; }
    
///
 
<summary>
    
///
 1 标识种子
    
///
 
</summary>
    
public
 
int
 IdentitySeed { 
get
set
; }
    
///
 
<summary>
    
///
 标识增量
    
///
 
</summary>
    
public
 
int
 IdentityIncrement { 
get
set
; }
    
///
 
<summary>
    
///
 说明
    
///
 
</summary>
    
public
 
string
 ColumnDesc { 
get
set
; }
    
///
 
<summary>
    
///
 默认值
    
///
 
</summary>
    
public
 
string
 DefaultValue { 
get
set
; }
}

      代码说明:

数据库字段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
-
1
2
 
1
 
6
 
0
 
3
 
1
 
1
 
1
 
1
 
1
;
        }
        @font
-
face
        {
            font
-
family: 楷体_GB2312;
            panose
-
1
2
 
1
 
6
 
9
 
3
 
1
 
1
 
1
 
1
 
1
;
        }
        @font
-
face
        {
            font
-
family: 
"
\@宋体
"
;
            panose
-
1
2
 
1
 
6
 
0
 
3
 
1
 
1
 
1
 
1
 
1
;
        }
        @font
-
face
        {
            font
-
family: 
"
\@楷体_GB2312
"
;
            panose
-
1
2
 
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,如需转载请自行联系原作者
你可能感兴趣的文章
How To Capture Data Packets On A Network Using Wireshark (a. k. a. Ethereal)
查看>>
go语言操作mysql范例(增删查改)
查看>>
Install IE in debian linux
查看>>
遍历python字典几种方法
查看>>
SPOJ GSS5 Can you answer these queries V
查看>>
大数据应用期末总评
查看>>
[Inside] Behavioral Interview
查看>>
6、NIO--分散读取与聚集写入
查看>>
C++变长参数
查看>>
IO完成端口
查看>>
Python中函数的知识点
查看>>
利用chardet检测网页编码
查看>>
【转】HashMap遍历方法
查看>>
ZCMU Problem G: 素数对(数论,素数筛法)
查看>>
iOS 摇一摇
查看>>
IOS5 ARC(自动引用计数器) 一些属性介绍
查看>>
C#之LINQ与XML
查看>>
Android模拟器端口被占用问题的解决办法
查看>>
双十一背后云计算的支撑
查看>>
《计算机图形学基础(OpenGL版)》使用院校(更新)
查看>>