Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best SQL Server data type to store .jpg or .pdf files in
Message
From
12/06/2023 12:00:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
09/06/2023 14:22:06
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01686720
Message ID:
01686725
Views:
55
>Hi!
>
>I have a table that holds data for the company's customers, and I need to store the id card for each one of them. So, I wonder what the best way is to store .jpg or .pdf files and how it can be done with Visual FoxPro 9 connected to the SQL Server Table. And then how to show the .jpg or .pdf files within my Visual FoxPro application.

If in dbfs, use a binary (i.s. nocptrans) memo field. If any server, use whatever that server has for binary memos - blob, varchar(max) or something. However, if you do that, and fill the memo with
replace binmemo with filetostr(lcFile)
you'll have to extract it into a temp folder every time you show them, and make sure that temp folder is emptied regularly, or you may start losing disk space. You may save space in your tables by storing zipped documents (except compressed images and *.???x documents, which are already compressed).

The other approach is to just store filenames in your tables (usually a varchar(300) field would suffice for longest paths, though if you have multiple files in the same directory, it would make sense to store directories in one table and the filenames in another), and the files stay were they were. Much simpler in terms of storage and manipulation, but
- you need to keep them synchronized, i.e. recheck the directories at times
- until you do, you may have stored paths to files which are no longer there, were renamed, moved and whatnot.
- actually you may lose them all, if they're on a network share and the server gets rebuilt (this did happen!) under a different name, or the share name changes (also happened). Then you have more work to adjust the paths to their current location.

I don't know which is worse, probably both. Used both approaches, and still didn't like either of them.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform