Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Storing File Contents in SQL Server Image Data Type
Message
 
 
À
10/01/2001 18:28:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00461989
Message ID:
00462105
Vues:
29
Hi!

It is VFP problem. When you pass character variable as parameter for SPT query, it used always as character type. Thus this causes truncating it to 255 chras when you try to update memo field and does not allows to update image field. Put data into temporary cursor field and update from tehre.

However, above is only part of the problem. The real problem is that VFP requires general field type to update data for image field on SQL server. There are 2 workarounds. Usually developers use views for that, where you can define for each field how to map types of field. See also Q145991 and Q245714 articles in MSDN.

When you don't want to use views, see following Thread#427023 Message#427217, where I described exact technique of binary file transferring into and from image field on SQL Server (I guess I will put it into the FAQ...).



>I was trying to write an application that would store a binary image of actual file contents to SQL Server. I stored the file contents to a variable using lcContents = FILETOSTR( ) and then tried to include this in an INSERT command:
>
>SQLEXEC( lnConn, [INSERT INTO MyTable ( ,,, Fil_Contents ) VALUES ( ,,, ?lcContents )] )
>
>This failed with the following error from SQL Server:
>
>Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: text is incompatible with image
>
>Any idea what I did wrong? The field Fil_Contents is using the "image" data type, which BOL indicated was correct for binary data larger than 8K.
>
>TIA,
>
>-- Randy
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform