DOCUMENT:Q145991 20-AUG-1999 [foxpro] TITLE :HOWTO: Inserting an OLE Object into a SQL Table by Using SPT PRODUCT :Microsoft FoxPro PROD/VER:3.00 3.00b OPER/SYS: KEYWORDS:kbcode kbvfp300 kbvfp300b kbvfp600 ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 6.0 ------------------------------------------------------------------------------- SUMMARY ======= This article explains how to place OLE information into a SQL table by using the SQL Pass Through (SPT) function SQLEXEC(). To achieve this, you need to pass the field as a parameter instead of passing a file name value. MORE INFORMATION ================ To place an OLE object such as a .wav or an .avi file into an Image field in a SQL table, you need to store it in a Visual FoxPro general field, and then call INSERT INTO to insert the general field in an Image field. For example, you can use the following syntax if you have a connection to a data source and you want to store the OLE information to an image field named imagfld: = SQLEXEC(mhandle,"INSERT INTO test(field1,imagfld); VALUES('Sound',?table.g_fld)") In this example, the field name of the local table is passed as a parameter to the server. This ensures that Visual FoxPro preserves the binary format of the OLE object. Note that if you pass the .wav file name in the INSERT command and bring the information back to Visual FoxPro, the error "OLE Object is invalid" is displayed when you click the General field. If you have an OLE object that is not stored in a .dbf file, you can create a temporary cursor and store the file in a cursor before you upload it. For example: CREATE CURSOR tmpole (g_fld G) APPEND BLANK APPEND GENERAL g_fld FROM "C:\win95\media\chimes.wav" Additional query words: ====================================================================== Keywords : kbcode kbvfp300 kbvfp300b kbvfp600 Technology : kbVFPsearch kbAudDeveloper kbVFP300 kbVFP300b kbVFP600 Version : 3.00 3.00b ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.