>我有以下代码
Dim dbMnt As OleDb.OleDbConnection
dbMnt = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:tempdata.mdb")
dbMnt.Open()
Dim qdfTabCols As DataTable = dbMnt.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, New Object(){Nothing, Nothing, "Table1")
Dim dr As DataRow
For Each dr In qdfTabCols
Msgbox(dr("TABLE_NAME") & " " & dr("COLUMN_NAME") & " " & dr("DATA_TYPE"))
'In here I would like to test the column data type
Next
在"For Each"中,我想测试各种列数据类型并以不同的方式处理它们。我以前只使用:dbText,dbMemo,dbDate。你如何在 VB.net 中写这个"如果"语句?
If (dr("DATA_TYPE") = ????) Then
如果我
没记错的话,DATA_TYPE
将包含OleDbType Enum。试试这个 :
If (dr("DATA_TYPE") = OleDb.OleDbType.DBDate) Then