Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is a table part of a dbc? How to??
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00554114
Message ID:
00581803
Views:
24
Sergey,

I need to know database name without opening the table. How this program should be modified to return database name?

Thanks a lot in advance.

>>Nadya -
>>
>>So far, I think you are giving me the best advice. The idea of searching withing the DBF (I would just open it with low-level file i/o and grab the header) and searching for .DBC might do the trick.
>>
>>Thanks!!
>>
>>Regards,
>>AL
>
>Here's a code to check if table is in a dbc or free
>
lnFh1 = FOPEN("orders.dbf")
>* Position of the first data record - 2 bytes
>= FSEEK(lnFh1, 8, 0)
>lcB1 = FREAD(lnFh1,1)
>lcB2 = FREAD(lnFh1,1)
>* Offset to the beginning of the DBC name
>lnOffset = ASC(lcB2) * 256 + ASC(lcB1) - 264 - 1
>= FSEEK(lnFh1, lnOffset, 0)
>* The first byte of DBC name or 0x00 if it's free table
>lcB3 = FREAD(lnFh1, 1)
>IF ASC(lcB3) = 0
>  * free table
>ELSE
>  * table in dbc
>ENDIF
>= FCLOSE(lnFh1)
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform