When I was in the vb.net programming, using GetSchema table field information, can obtain the data type (DATA_TYPE) values, such as 129, but unable to get the name of the data type (the Type_Name), such as 129 corresponds to the name should be a string, how do I get, or how to transform type value 129 string for the name, thank you, code after briefly as follows:
Dim Conn As new OledbDbConnection
Dim Fields As New DataTable
Fields=conn. GetSchema (" Columns ", FilterValues)
For Each row As DataRow Fields. In Rows
The debug.? The row (" COLUMN_NAME ") & amp; Row (" DATA_TYPE ") 'here, can obtain the field name, data type, but not type name
Next
CodePudding user response:
To provide a train of thought, you can directly take to use directly by the SQL statement, SQL code field information is as follows;SELECT
The table name=the convert (varchar (50), d.n ame),
The field name=the convert (varchar (100), a.n ame),
Type=the CONVERT (varchar (50), b.n ame) + '(' + CONVERT (varchar (10), a. ength/2) +') ',
Field=the convert (varchar (50), isnull (g. [value], ")),
Mandatory=case Anderson snullable when 1 then 'no' else 'is' end
The FROM dbo. Syscolumns a
Left the join dbo. Systypes b on a.x usertype=b.x usertype
Inner join dbo. Sysobjects d on Anderson, d=d.i d and d.x type='U' and d.n ame<> 'dtproperties'
Left the join dbo. Syscomments e on a.c default=e.i d
Left the join sys. Extended_properties g on Anderson, d=g. ajor_id and a.c olid=g. inor_id
Left the join sys. Extended_properties on d.i d=f f. may ajor_id and f. may inor_id=0
- where d.n ame='WeChatSeeingRules'
Where a.n ame not in (' _Identify ', '_Locked')
The order by d.n ame