I'm porting a VFP 9 application to SQL Server. The VFP app has some tables with "general" fields in them. I get a byte array when query the field, and when I save it to disk, I can look inside and see it's a word document, or a Paint BMP, etc.
From reading around, I've found that the general field is a proprietary format and contains a thumbnail image of the preview of the document (amongst other things, I'm sure).
Can somebody point me to some code that would extract firstly the type of file, and then the actual file data that I can save as the original file. (Getting the preview image out would be nice too.)
Apparently back in the day, somebody wrote a program in foxpro called GENTOFIL.PRG which sounds like it converts general fields to a file. But, google doesn't help much when trying to find that!
The "General" field type in VFP is a bit of an oddity...
From the VFP Help docs:
The key thing to note here is that the "general" field type of VFP deals with Microsoft OLE objects and they can be either linked or embedded. Also, VFP's ability to directly manipulate OLE objects appears to be minimal because when invoking actions on contained OLE objects, the associated application is actually run to open/edit the contents of the OLE-bound "general" field.
If, as you have said, you are able to extract the file by hand, that's probably the best way to go about getting the files out, as even VFP provides minimal ways to interact with the data contained in general type fields.
If you know the content of the General field is a Word Document I have some Visual FoxPro code recommended by someone that should extract it.
If you need help extracting an image out of the table you can check out a Microsoft KB article I have used in the past.
http://support.microsoft.com/kb/894819
Rick Schummer Visual FoxPro MVP