Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server field type to store .pdf file (Part II)
Message
From
03/08/2004 08:50:04
 
 
To
03/08/2004 08:38:59
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00930283
Message ID:
00930305
Views:
16
Gregory,

Unfortunattely, they didn't work. I agree with you that way *should* be the way to do it, but SQL Server vs VFP don't <s>

In both cases I got message Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: text is incompatible with image.

Fernando

>hi Fernando,
>
>I'm not much into SQL server and I have never used an insert with binary fields.
>
>I can only use your example and modify it a bit. Maybe one of the following solutions works
>
>
>local pdfValue
>
>pdfValue = FileToStr('C:\Temp\The Myth of Self-Describing XML.pdf')
>cSQLString = "Insert Into Teste (TestField    ) " + ;
>             "                                  " + ;
>             "           Values (?pdfValue) "
>
>
>
>or
>
>
>create cursor xxx ( xxx M NOCPTRANS)
>insert into xxx (xxx) values (FileToStr('C:\Temp\The Myth of Self-Describing XML.pdf'))
>
>cSQLString = "Insert Into Teste (TestField    ) " + ;
>             "                                  " + ;
>             "           Values (?xxx.xxx) "
>
>
>
>
>>Hi Gregory,
>>
>>>Why do you use a General field ?
>>
>>As seen in thread #918564, it seemed to me the way to go. I'm still open to new ways to approach this problem if there are other ones better than this (can tell you I'm not confortable with this one).
>>
>>>Could you work with inserting FileToStr('C:\Temp\The Myth of Self-Describing XML.pdf') ?
>>
>>I tried this way, but it doesn't work (get an error message from SQL Server at the insert).
>>
>>Regards,
>>
>>Fernando
>>
>>>>Hi,
>>>>
>>>>Following my "odissey" to store .pdf files in SQL Server's image field (Thread #918564), I could acomplish that task with the following code:
>>>>
>>>>cSQLDataSource = "MyDataSource"
>>>>cSQLUserId     = "MyUserId"
>>>>cSQLPassword   = "MyPassword"
>>>>
>>>>nSQLHandle = SqlConnect (cSQLDataSource, cSQLUserId, cSQLPassword)
>>>>
>>>>CREATE CURSOR tmpole (g_fld G)
>>>>APPEND BLANK
>>>>APPEND GENERAL g_fld FROM "C:\Temp\The Myth of Self-Describing XML.pdf"
>>>>
>>>>cSQLString = "Insert Into Teste (TestField    ) " + ;
>>>>             "                                  " + ;
>>>>             "           Values (?tmpole.g_fld) "
>>>>
>>>>SqlExec (
>>nSQLHandle, cSQLString)
>>>>
>>>>So I addapted the code above to the app I was working in. Everything worked fine in my tests populating the SQL Server table with .pdf file, the .ASP part of the problem also worked fine, BUT when my fellows in the other development area started to run their tests it failed.
>>>>
>>>>What happened: when I run the VFP app inserting the .pdf files into the SQL Server table from my PC it works fine, but when I deployed the .exe to the other fellows PC in order they could run the program by themselves, it run and inserted the .pdf in SQL Server table, but when the .ASP app tried to show the .pdf file it showed missing parts, sometimes crashed etc.
>>>>
>>>>What could that be?
>>>>
>>>>TIA,
>>>>
>>>>Fernando
>>>
>>>
>>>Fernando,
>>>
>>>Why do you use a General field ?
>>>
>>>Could you work with inserting FileToStr('C:\Temp\The Myth of Self-Describing XML.pdf') ?
>>>
>>>You may need to handle it differently when retrieving it
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform