Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting data FROM a general field
Message
 
À
18/11/1999 02:26:41
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00291910
Message ID:
00292374
Vues:
14
Cetin,

Thanks for the info. While I was struggling with this I discovered a what could be a easier way to do this. It may not work with all data types, But it worked fine with the fxp data I was trying to move.

After the view to SQL server is created and the column is defined by VFP as a general field. Use the dbsetprop command to change the datatype in the view from "General" to "memo". Now all that has to be done is to issue the "copy memo" command to write the data. This might work for bmp's(just in case I plan to hang on to you code).

Thanks Again.

Alan

>>I have a column in a SQL server table that I referance via VFP
>>5.0 remote view. In the table there is a column with the type
>>"image" this column is seen as a "general" in VFP. I need to get
>>the data in that column and write it to a file with the users
>>choice of name. How can this be done? I initaly thought there
>>might be a "copy from general" that worked like "copy from memo"
>>no such luck.
>>
>>HELP !!!
>>
>>Thanks in advance
>>
>>Alan Sheffield
>
>
Alan,
>You can try this routine after changing slightly (automatically adds bmp extension) :
>
function SaveBMPs
>lparameters tcTable, tcField, tnRecNo, tcOutFileName
>* tcTable - Tablename containing BMP gen field
>* tcField - Gen field name
>* tnRecNo - recno no extract
>* tcOutFileName - path and fielname of output filename except .BMP extension (no check)
>local handle, handleout, lcTable
>lcTable = "T"+sys(2015)
>select &tcField from (tcTable) ;
>	where recno() = tnRecNo ;
>	into table (lcTable)
>use
>handle=fopen(lcTable+".fpt")
>handleout=fcreate(tcOutFileName+".bmp")
>lnSize = fseek(handle, 0, 2) && Seek to eof and get size
>=fseek(handle,599)           && Go to start of gen file
>if ( lnSize - 599 ) % 2 = 0  && Might it be a duplicate ? Let's check
>     lcFirst = fread(handle, (lnSize - 599)/2) && Read first part to lcFirst
>     lcSecond = fread(handle, lnSize) && Read rest to lcSecond
>                                      && lnSize is totlen
>                                      && but fread() would stop at feof()
>     =fwrite(handleout, lcFirst, lnSize) && Again lnSize is bigger but
>                                         && correct size would be written
>     if lcFirst # lcSecond      && It was not a duplicate, so write lcSecond too
>        =fwrite(handleout, lcSecond, lnSize)
>     endif
>else
>   =fwrite(handleout, ;
>              fread(handle,lnSize), ;
>           lnSize)                 && Since now we have a size at hand.
>                                   && So let's do readwrite in one pass
>endif
>=fclose(handle)
>=fclose(handleout)
>erase (lcTable+".*")
Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform