Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving Binary File to/from SQL*Server
Message
From
06/11/2001 12:29:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00577111
Message ID:
00578079
Views:
30
>Hi!
>
>>Vlad,
>>What I said is explanatory. You can store binary data (like zip) to SQL server image datatype and can retrieve it. As far as I could see faq#7995 already updated. When I wrote my message it clearly had :
>>
>>"Image field on SQL Server mapped to general field in VFP, causing no way to use image field just to store binary data, for example, ZIP file."
>>
>>Really I didn't know I could update it and would never update someone else's document.
>>
>
>I did not knew too until recent changes in UT interface. Of course, this probably require some rules, like at the Wiki site...
>
>>For write part I would do something like this (Image datatype) :
>>
>>*Write
>>create cursor temp (DataFile g)
>>append blank
>>append general DataFile from (getfile())
>>SQLEXEC(lnHandle,"insert into tablename (f1,f2,ImageField) values ('VarChar','VarChar',?Temp.DataFile)")
>>use in 'Temp'
>>*Read
>>SQLEXEC(lnHandle,"select * from tablename")
>
>Cetin, above way you save file as a content of General field. BUT, how you will read it and get the file back to disk??? When talking about universal approach (saving ANY document type in image field in SQL Server), APPEND GENERAL result is quite different for different file types. Do you know a *universal* way to extract that file from General field after APPEND GENERAL ... FILE ... command? There are not reverse command, and I did not found uniiversal aproach but approach for bitmaps only based on extracting phisycal content of General field (the same way as in my approach - converting it to memo) starting from the certain offset byte. Just compare - my approach puts just a file in a general field, when your - file with some other information required for correct General field formatting. The approach I talked about is for working with plain files, not files in General fields.

Vlad,
OK.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform