Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Information about all tables in dbc
Message
 
 
À
22/09/2004 02:48:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00944853
Message ID:
00945061
Vues:
24
>Dear Nadya
>
>I am unable to write codes to get task.
>So you are requested to please write some codes for me.
>
>Thanks in advance

Here is an alternative method which doesn't require opening tables:
create cursor curAllDBCTables (TablePath M, TableName C (40), Records I, Size I, Modify D)
open database d:\cotton\tables\weight.dbc
local lnI, lnTables, lnTable
lnTables = ADBOBJECTS(laTables, "Table")

for lnI = 1 to m.lnTables
   lnTable = adir(laTableInfo, FULLPATH(dbgetprop(laTables[m.lnI],"TABLE", "PATH"),dbc()))
   if m.lnTable = 1 && The table exists
       insert into curALLDBCTables (justpath(laTableInfo[1,1], ;
                                                      laTables[m.lnI],  ;
                                                     GetReccount(laTableInfo[1,1], ;
                                                     laTableInfo[1,2],  ;
                                                     laTableInfo[1,3])
  endif
next
Where GetRecCount is my custom function:
********************************************************************
*  Description.......: GetRecCount - gets reccount() using low-level functions
*  Calling Samples...:
*  Parameter List....: tcTableFullName,
*  Created by........:  Nadya Nosonovsky 09/22/2004 1:47 pm
*  Modified by.......: 
********************************************************************
lparameters tcTableFullName
if vartype(m.tcTableFullName)<>"C"
	tcTableFullName = getfile('DBF','Select','&Choose',0,'Select table to check database')
	if empty(m.tcTableFullName) && User pressed cancel
		return ''
	endif
endif
local lnFh1, lcBuffer, lnReccount
lnReccount = -1
lnFh1 = fopen(m.tcTableFullName) && To read
if m.lnFh1 <> - 1
* Make sure that's VFP table
	lcBuffer = fread(m.lnFh1,1)
	if asc(m.lcBuffer) <> 0x30
* not VFP table
		= messagebox( "***NOT VFP TABLE***",48,'Error')
	else
* Record Count - 3 bytes
		= fseek(m.lnFh1, 4, 0)
		lcBuffer = fread(m.lnFh1,3)
		lnReccount = asc(m.lcBuffer)
	endif
	= fclose(m.lnFh1)
else
	=messagebox('File '+ m.tcTableFullName+' could not be opened',48,'Problem')
endif

return m.lnReccount
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform