使用Ado.net获取数据库架构信息
![](/Images/OutliningIndicators/None.gif)
textBoxConnString 文本框
btnGet 按钮
dataGridView1 GridView
private void btnGet_Click(object sender, EventArgs e)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
得到的表格中,有一列DATA_TYPE为数据类型,数据为数字,经过分析,对应关系如下:
smallint 2
int/数字 3
real 4
float 5
money,smallmoney/货币 6
bit/是/否 11
sql_variant 12
tinyint 17
bigint 20
uniqueidentifier 72
binary,timestamp,image,varbinary/ole对象 128
char,text,varchar 129
nchar,ntext,nvarchar/文本,备注,超链接 130
numeric 131
smalldatetime,DateTime/日期时间 135