如何获取字段数据类型 [英] How to get Field Datatype

查看:163
本文介绍了如何获取字段数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从访问表中获取字段的数据类型(Access 2007)

例子
-------

How to get Datatype of a Field from access table (Access 2007)

example
-------

Public SchemaTable2 As DataTable
dim int1 as Integer
SchemaTable2 = oleConn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, _
                    New Object() {Nothing, Nothing, Nothing, Nothing})

For int1 = 0 To SchemaTable1.Rows.Count - 1
if SchemaTable2.Rows(int2)!TABLE_TYPE.ToString = "TABLE" then
Form1.ListView2.Items.Add(SchemaTable1.Rows(int1)!COLUMN_NAME.ToString()) ''ColumnName


在上面的这里,我能够获得列名.如何获取字段名称,查询其文本,整数,双精度或字符串还是Char


Here in above i am able to get the Column name. How to get field name, wheather its text, Integer, double or string or Char

推荐答案

只需访问DataType
Just access the DataType property [^]of the column to get the DataType.


这篇关于如何获取字段数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆