Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

General field and jpeg

Status
Not open for further replies.

hunterspot

Programmer
Jun 3, 2009
22
US
I am trying to insert a jpeg file into the general field in one of my tables. i used both these commands to achieve this without success.

When I used append general pic from c:\mylogo

it gives me error file 'c:\mylogo' does not exist, while it is there.

When I used
replace pic with "c:\mylogo" in logos

it gives me error data type mismatch.

i also used the file extension .jpeg, added the class parameter, bu nothing worked.

Would you please tell me what am I doing wrong here? Any help is highly appreciated.

Thanks
PD

 
I tried with file extension and without file extension, but no use.
 
In general it mostly has been advised not to use the general field. Instead just store the name of jpg with it's location.
-Bart
 
PD,

First, you definitely need the extension. Geoff's point was that the extension might not be obvious if your Windows Explorer is configured to hide the extension. Worth checking, perhaps.

Second, I suggest you try this (in the command window)

Code:
? FILE("c:\mylogo.jpeg")

If it prints .F., then you know the file is missing. If it doesn't, then there's some other factor at work that we don't know about.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Correct syntax includes extension, ie:

append general myPic from ("c:\temp\MyLogo.jpg")

However as Nifrabar pointed out, it is not advised to use general fields. Instead either store the full path or store the file to a blob/memo field. General fields are trouble.

Better yet use SQL server 2008 where you have a chance to use FILESTREAM attribute.

Cetin Basoz
MS Foxpro MVP, MCP
 
No it isn't. It is a pleasant excuse to exchange your backend to a better and reliable one. You might use it just for the pictures if you want or upsize your whole database.

Cetin Basoz
MS Foxpro MVP, MCP
 
I second everyone recommending to not store pipctures into a general field. Be it the size limitation and the bloating of the fpt file alone, be it the outdated OLE 1.0 working in general fields, be it the instability of showing pictures with Olecontrols, when the application associated with BMP changes, be it the hard way to get at the pictures again, once they are in the general fields.

On the other hand, the only thing missing besides the full file name with file extension maybe is, that you need to know: APPEND GENERAL does not create a new record but fills the current record only, so before you can do an APPEND GENERAL you need to be on a record.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top