Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Database fields and tables
Message
From
10/10/2005 09:18:18
 
 
To
10/10/2005 07:18:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01057607
Message ID:
01057637
Views:
10
This should get you started:
ddir = "C:\mydbcdirectory\"  && change this to the dbc directory

SET SAFETY OFF
CLOSE ALL
=ADIR(dbfiles,ddir+"*.dbc")
SELE 0
CREATE TABLE dbctables (cdbc c(25), ctable c(100), cobjname c(25), ctype c(20))
FOR i = 1 TO ALEN(dbfiles,1)
   IF TYPE('dbfiles(i,1)') <> "C" .or. EMPTY(dbfiles(i,1))
      LOOP
   ENDIF
   IF !FILE(ddir + dbfiles(i,1))
      LOOP
   ENDIF
   SELE 0
   USE (ddir + dbfiles(i,1)) ALIAS dbconefile
   IF USED('dbconefile')
      WAIT WINDOW "Working On: "+ddir+dbfiles(i,1) NOWAIT
      SELE dbconefile
      =AFIELDS(amyfields)
      talias = ALIAS()
      SET FILTER TO UPPER(ALLTRIM(objecttype)) = "TABLE"
      GO TOP
      SCAN
         IF !DELETED()
            STORE RECNO() TO mrecno
            STORE ALLTRIM(UPPER(objectname)) TO lcobjname
            WAIT WINDOW "Working on: "+lcobjname NOWAIT
            SELE dbctables
            APPEND BLANK
            REPLACE dbctables.cDBC WITH UPPER(ALLTRIM(LEFT(dbfiles(i,1),RAT(".",dbfiles(i,1))-1)))
            REPLACE dbctables.cobjname WITH UPPER(ALLTRIM(lcobjname))
            REPLACE dbctables.ctype WITH "TABLE"
            FOR it = 1 TO ALEN(amyfields,1)
               IF TYPE('amyfields(it,1)') = "C"
                  APPEND BLANK
                  REPLACE dbctables.cdbc WITH UPPER(ALLTRIM(LEFT(dbfiles(i,1),RAT(".",dbfiles(i,1))-1)))
                  REPLACE dbctables.ctable WITH DBF()
                  REPLACE dbctables.cobjname WITH amyfields(it,1)
                  REPLACE dbctables.ctype WITH "FIELD"
               ENDIF
            ENDFOR
            SELECT dbconefile
            IF RECNO() <> mrecno
               GOTO mrecno
            ENDIF
         ENDIF
      ENDSCAN
      IF TYPE('ALEN(amyfields,1)')="N"
         RELEASE amyfields
      ENDIF
      SELECT dbconefile
      USE IN dbconefile
   ENDIF
ENDFOR
SELE dbctables
browse
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform