Long ll_Col,ll_Row
Long ll_ColCount,ll_Value
String ls_ColName,ls_ColType,ls_Value
DateTime ldt_Value
ll_ColCount = Long(dw_1.Describe("datawindow.column.count"))
For ll_Col = 1 To ll_ColCount
ls_ColName = dw_1.Describe("#"+String(ll_Col)+".name")
ls_ColType = dw_1.Describe("#"+String(ll_Col)+".coltype")
ls_ColType = Upper(ls_ColType)
If Pos(ls_ColType,'CHAR') > 0 Then
ls_Value = dw_1.GetItemString(ll_Row,ls_ColName)
ElseIf ls_ColType = 'DATETIME' Then
ldt_Value = dw_1.GetItemDateTime(ll_Row,ls_ColName)
ElseIf ls_ColType = 'LONG' Then
ll_Value = dw_1.GetItemNumber(ll_Row,ls_ColName)
Else //等等...
End If
Next
你可以用dw_1.describe("列名.coltype")判断一下类型,再用相应的getitemstring或者getitemnumber之类去取
Describe argument:
"controlname.ColType"
Parameter Description
controlname The column for which you want the datatype. Possible datatypes are:?Char (n) - n is the number of characters?Date?DateTime?Decimal (n) - n is the number of decimal places?Int ?Long?Number?Real?Time?Timestamp?ULong