about FW_ADOX_CreateExcelTable() :
i wonder that FW_ADOX_CreateExcelTable() crash at FIELD "MARRIED" which is not 1st or Last FIELD in DBF
FIELD "MARRIED" is Type "L", adBoolean but FUNCTION DateCheck() seems not to check for Type "L"
[ 1] = C MARRIED
[ 2] = N 11
in DBF i have .T. / .F. but under SQL it can be TRUE / FALSE or 1 / 0 ...
---
i have try to include ADOX again and it work so far ...
Code: Select all | Expand
FUNCTION FW_ADOX_CreateExcelTable( oCn, cTable, aStruct )
LOCAL oCat := CreateObject( "ADOX.Catalog" )
LOCAL oTable, aFld, n, cType
LOCAL oCol
LOCAL nType, nLen, i, iMax, cName
oCat:ActiveConnection := oCn
cTable := LOWER( cTable )
oTable := CreateObject( "ADOX.Table" )
oTable:Name := cTable
#ifdef Use_AEVAL // old CODE
AEVAL( aStruct, < | aFld, i |
LOCAL nType := ;
IF( aFld[ 2 ] == "C", adVarWChar, ;
IF( aFld[ 2 ] $ "DT=@", adDate, ;
IF( aFld[ 2 ] == "L", adBoolean, ;
IF( aFld[ 2 ] $ "+N", adDouble, adLongVarWChar ) ) ) )
oTable:Columns:Append( aFld[ 1 ], nType )
IF i == 7
oCat:Tables:Append( oTable )
oTable := oCat:Tables( cTable )
ENDIF
RETURN nil
> )
#else // new CODE
iMax := LEN(aStruct)
FOR i := 1 TO iMax
oCol := CreateObject( "ADOX.Column" ) // need for every Column
cName := aStruct[i][ 1 ]
DO CASE
CASE aStruct[i][ 2 ] == "C"
nType := adVarWChar
CASE aStruct[i][ 2 ] $ "DT=@"
nType := adDate
CASE aStruct[i][ 2 ] == "L"
nType := adBoolean
CASE aStruct[i][ 2 ] $ "+N"
nType := adDouble
ENDCASE
nLen := aStruct[i][ 3 ]
fwlog i , cName, nType, nLen
ocol:Name := cName
ocol:Type := nType
IF aStruct[i][ 2 ] == "C"
ocol:DefinedSize := nLen
ENDIF
oTable:Columns:Append( ocol )
NEXT
fwlog i , Var2char(oCat), Var2char(oTable), Var2char(oCat:Tables), Var2char(oTable:Columns)
* IF i == 7
oCat:Tables:Append( oTable )
oTable := oCat:Tables( cTable )
* ENDIF
#endif
RETURN nil
i can SET ocol:DefinedSize := nLen and oTable:Columns:Append( ocol ) but FWAdoStruct( oRs ) still give me 255
---
i´m not sure what cDbms := FW_RDBMSName( oRs:ActiveConnection, .f. ) will give with Excel
i like to REQUEST to enhance function FWAdoFieldStruct() to use Value of
oField:DefinedSize
when use Excel and o:DefinedSize is valid