Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Storing binary files ni SQL Server binary fields
Message
From
21/06/2001 09:00:22
 
 
To
20/06/2001 14:36:04
Hermann Strijewski
Fast Track Business Solutions
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00521605
Message ID:
00521846
Views:
13
Hi!

lcMyFile = FileToStr('MyDocument.doc')
lnID = 5
=SQLEXEC(m.nHandle,"Update MyData SET MyBinaryField=?lcMyFile WHERE SID=?lnID")

If you use views, you can get nHandle following way:
nHandle = cursorgetprop('ConnectHandle','SomeViewAlaisName')

Note that you have to use the image field type on SQl Server to store binary data. If you use TEXT (memo) type, your data will be corrupted on SQL Server.

In addition, there is a problem in retrieving such data from SQl Server. Take a look to the FAQ#7995

HTH.

>Hi there!
>
>I'm just about to finish my first SQL-Server based app.
>
>I have a table on MS SQL Server where I need to store entire binary FILES (e.g. a Word Document) in a binary FIELD, but I can't figure out what syntax to use to load or retrieve that information.
>
>Could you give me a pointer as to what to do, e.g. where to look or what command to use? I can see that SQL Passthrough won't work, because I cannot use something like UPDATE MYTABLE SET BINARYFIELD=FILETOSTR("WORDDOC.DOC") WHERE RECID=5
>
>But that's really what I want to do
>
>Does anyone have any ideas as to what to do. I figure it needs an ADO object, but how???
>
>Thanks so much!
>Hermann Strijewski
>Clearwater, FL
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform