从DataTable获取Dbtype [英] get the Dbtype from DataTable
问题描述
你好,我有一个从数据集填充的数据表
Th pbs我试图获得DBTYPE但现在没有结果
任务是如果类型是Date,那么显示格式将是"dd-MMM-yy",如果类型是Datetime,那么显示格式将是"dd-MMM-yy HH:mm:ss"。
有没有办法得到DBTYPE而不是Me.Datatabe.Columns(索引).DataType.ToString ??
我需要帮助急
非常感谢你帮助
嗨...
从数据表我们可以得到DataType。
使用DataSet.Tables("TableName")。列(" ColumnName")。DataType.FullName
构造这样的语句..
选择Case DataTable.Columns(" ColName")。DataType.FullName
案例"System.Int32"案例"System.DateTime"
结束Sele ct
但是你有一个单独的数据类型为Date和DateTime。你必须检查数据是否包含时间,如果是,那么你必须相应地设置显示格式。
谢谢。
Hello,
I have a Datatable that is filled from a dataset
Th pbs that i am trying to get the DBTYPE but not result to now
the task is if the type was Date so the display format will be "dd-MMM-yy"
if the type was Datetime so the display format will be "dd-MMM-yy HH:mm:ss"
is there is any way to get the DBTYPE and not the Me.Datatabe.Columns(index).DataType.ToString??
I need help urgent
thank you very much for helpin
Hi...
From the datatable we can defintely get the DataType.
Use the DataSet.Tables("TableName").Columns("ColumnName").DataType.FullName
Construct your statment like this..
Select Case DataTable.Columns("ColName").DataType.FullName
Case "System.Int32"
Case "System.DateTime"
End Select
But you will have have a seperate data Type for Date and DateTime. You have to check in the Data whether it includes the Time, if so then you have to set the display format accordingly.
Thanks.
这篇关于从DataTable获取Dbtype的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!