以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如何准确返回数据库中每一列的类型  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=171231)

--  作者:13568406997
--  发布时间:2021/8/23 11:56:00
--  [求助]如何准确返回数据库中每一列的类型
要求准确到是integer、short、double、single等
--  作者:有点蓝
--  发布时间:2021/8/23 12:03:00
--  

    For Each c As DataCol In DataTables("表A").DataCols
        Dim dr As DataRow = DataTables("管理").AddNew
        dr("表名") = dt.Name
        dr("列名") = c.Name
        dr("长度") = c.MaxLength
        Select Case c.DataType.Name
            Case "String"
                If c.MaxLength > 255 Then
                    dr("类型") = "备注"
                Else
                    dr("类型") = "字符"
                End If
            Case "DateTime"
                dr("类型") = "日期时间"
            Case "Boolean"
                dr("类型") = "逻辑"
            Case "Int32"
                dr("类型") = "整数"
            Case "Int16"
                dr("类型") = "短整数"
            Case "Byte"
                dr("类型") = "微整数"
            Case "Double"
                dr("类型") = "双精度"
            Case "Single"
                dr("类型") = "单精度"
            Case "Decimal"
                dr("类型") = "高精度"
        End Select
    Next


--  作者:13568406997
--  发布时间:2021/8/23 12:08:00
--  
谢谢