Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting word file into SQL from VFP
Message
 
 
À
17/01/2001 14:31:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00464763
Message ID:
00464846
Vues:
20
Hi!

First of all, string parameter in SPT truncated to 255 characters, so do not use it. It even do not works with text field on SQL server. You require to put value into the cursor and than reference cursor field as a parameter. For example:
* following works for text field only:
&& lVar1 = FileToStr("myfile.doc")
select 0
create cursor Temp (FMemo M)
append blank
append memo FMemo from ("myfile.doc")
SQLExec(n, [insert into mytable (docs) values (?FMemo)])
For image field on SQL Server you require to use general field in table using the approach I described in the sample code (read binary data into temporary table, hack table to change memo type to general, than use general field for update as parameter of insert statement). Without general field you will get error about type mismatch from ODBC (or VFP?). Looks a bit messy, but I did not found any better way to do that except remote views with image field mapped to memo in view.

>>Hi!
>>
>>Yes, you're correct, but there are many rocks on the way. See here FAQ#7995713 in Faq section -> Client/server -> "How to work with Image field type on SQL Server?"
>>
>>>Hi,
>>>
>>>What is the best way and the proper syntax to insert a word document from VFP into SQL Server 7.0 using SPT?
>>>
>>>Assume I have
lDoc = FileToStr("mydoc.doc")
How do I then insert up into SQL Server? Is "Image" the correct data type on SQL side?
>>>
>>>Thanks!
>
>so - there's no way to convert a variable from a str to the proper type to insert directly into an image field on SQL? I would like to do this ...
>
>lVar1 = FileToStr("myfile.doc")
>lVar2 = SomeConversionFunction(lVar1)
>SQLExec(n, [insert into mytable (docs) values (?lVar2)])
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform