FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Fivewin and access
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Fivewin and access
Posted: Thu Aug 21, 2008 07:40 AM

I have to write data (from a dbf) in an access table .
How to know the field type, field size of all the fields of the access table .

It seems that there is an error when a try to write a field longer then
the defined lenght in the access table .
Thanks for your help .

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin and access
Posted: Thu Aug 21, 2008 08:43 AM
This is a sample:

FUNCTION MAIN()

    LOCAL oCat

    LOCAL i, j

    oCat = CREATEOBJECT( "ADOX.Catalog" )

    oCat:ActiveConnection = "your connection string here"

    FOR i = 0 TO oCat:Tables:Count() - 1
        ? oCat:Tables( i ):Name
        ?

        FOR j = 0 TO oCat:Tables( i ):Columns:Count() - 1
            ? SPACE( 4 ),;
              PADR( oCat:Tables( i ):Columns( j ):Name, 20 ),;
              STR( oCat:Tables( i ):Columns( j ):Type, 5 ),;
              STR( oCat:Tables( i ):Columns( j ):DefinedSize, 10 ),;
              STR( oCat:Tables( i ):Columns( j ):Precision, 5 )
        NEXT

        ?
    NEXT

    RETURN NIL

Continue the discussion