Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>>>Does anybody have some example code to USE a .DBC (ie not OPEN DATABASE) and read from its Property field the table name and path for all contained tables (objecttype = Table)? We want to ensure that the user has not deleted any before opening the database in the normal manner.
>>>>
>>>>TIA, Kevin
>>>
>>>You can use the dbc as if it were a dbf - USE database.dbc IN 0 SHARED. It is actually just a normal dbf itself as is everything in VFP (Form, Report, etc).
>>>
>>>Mostly filled with memo fields.
>>
>>Hi Nigel,
>>
>>Yes, that is what I have done. However, the field concerned - Property - is not a plain text field (binary memo I think), and I cannot just read the data. What I am looking for is help with interpreting the data in that field.
>>
>>Kevin
>
>I've just looked at this and nothing jumps out at me. The sequence of ascii values are 8,0,0,0,1,0,2,1,20,0,0,0,1,0,1 and then the table name (position 16). So SUBSTR(property,16) will return the table name. The path will be the same as the container path.
Thanks for that. Assuming it always starts at position 16, it works unless there are a lot of table rules / comments in the memo field, which can result in string too long errors. I have therefore started from position 16 and carried on to find the end of a ".DBF", and used that for a substring to give the desired table name. So far so good.
Kevin
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement