Vince,
Sorry, a slight error from me there, sorry forget about nvarchar(max)
<brainfart> as it is ntext fields you need 'cos only they can grow up to
1Gb.


Dave C

-----Original Message-----
From: Dave Crozier [mailto:[email protected]] 
Sent: 01 June 2009 16:35
To: 'ProFox Email List'
Subject: RE: File corruption when storing/retrieving files in MSSQL backend.

Vince,
 You need to use ntext or even nvarchar(max) as ntext/nvarchar(max) stores
the Unicode character whereas tesxt will only store the ASCII character set.
It doubles the amount of data held but it works - been there, got the
teeshirt.

Dave 

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Vince Teachout
Sent: 29 May 2009 17:54
To: ProFox Email List
Subject: File corruption when storing/retrieving files in MSSQL backend.

Hi, all.

I'm having a very frustrating problem, and hoping someone can send the 
clue fairy over.

In one of our apps, which has traditionally used a VFP backend, we have 
the ability for the user to store files into memo fields in the 
database, then later retrieve them and view them, based on file 
extension, with whatever the default handler is for that extension on 
their computer.

So the (simplified) gist is:

Saving the attachement:
        cBinData     = FILETOSTR("myfile.pdf")
        INKEY(1)  && give time to finish
        INSERT INTO MyATTACHMENTS (Attachkey, Bindata) ;
                          VALUES (cAttachkey, cBinData)

Retreiving is:
        COPY MEMO bindata TO ("MyTempFile.pdf")

Viewing is simply a call to shellexec, which works fine.

We've never had problems with this in a vfp backend, but now that we're 
using MSSQL, users are complaining of corrupted files.  One client looks 
like they are having PDF files corrupted during save, another has some 
issue where all but two bytes of the pdf file are copied out during the 
retrieve, causing Adobe reader to fail.  Of course, it works fine here, 
and I can't duplicate either problem.

We're all using MSSQL 2005, and the BinData memo field on the SQL server 
is a TEXT field.

Would happily welcome any flames or slights on my coding ability, as 
long as they contain clues, as well.  Thanks!

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cadd5be407484cebbaab12ad9d838...@develop
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to