Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Ole Object Not Reloading Post Reply Post New Topic
Author Message
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Topic: Ole Object Not Reloading
    Posted: 20 Sep 2011 at 4:28am
I am confused on this one.
 
On my last post I explained how to load an image dynamically into a report. This takes the image from the database, saves it as a gif and then using an ole object I put that on a report.  I have the box checked so it is a linked file which states that it should reload this each time the report is run but it is not doing it.
 
When I start up my web page and open the report it takes the current picture that is loaded ie c:\mygif.gif.  However, if I change this picture and then run the report again it pulls the old picture not the current one.  if I shut down the web page, start it back up and then run the report it does select the current picture saved as c:\mygif.gif. 
 
Also, If I wait long enough with the web page running it will reset and select the current image as well but I can't have that.
 
I am using VS 2005, and the built in crystal reports.  I need to dynamically load an image and it needs to update each time I run the report. 
 
Any help would be great!
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 20 Sep 2011 at 7:59am
I think that the browser is caching the image. I know that there are web codes you can put in your page header to tell the browser not to use caching. I don't know what they are, but you can google it to get the specifics.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Posted: 20 Sep 2011 at 8:34am
Thanks Brian.   I have tried a few different things already to make the page not cache. 
in the aspx.vb page I have tried
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
 
in the aspx page I have tried
 
<%@ OutputCache Location="None" VaryByParam="None" %>
 
 
Neither of these seem to work.
 
I see in the web.config file i have

<appSettings>

<add key="CrystalImageCleaner-AutoStart" value="true" />

<add key="CrystalImageCleaner-Sleep" value="60000" />

<add key="CrystalImageCleaner-Age" value="120000" />

</appSettings>

But I cannot figure out what I need to do with those or if that has anything to do with what I am dealing with.
 
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 20 Sep 2011 at 9:33am
One trick I've used to force ajax calls to not get cached is to put a dummy query string in the url. My code ignores the querystring value, but it makes the browser think that it's a unique page each time. For example, http:www.yoursite.com/reportpage.aspx?now=092220110142am 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Posted: 21 Sep 2011 at 3:53am
Thanks again Brian.
 
Unfortunately that did not fix the problem. The gif is still getting stored and it is not updating. 
 
Just to make sure I have explained what is happening correctly here it is again.
 
1. create ole object with link check box checked and set it to a gif on my hard drive.  The link button says that if the file on the hard drive is updated it will reflect on the report each time the report is run.
2. run the web page with the report and it pulls the gif that is on the hard drive.
3. update the gif to something different.
4. run the report again and it still pulls the original picture.
 
 
 
IP IP Logged
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Posted: 21 Sep 2011 at 5:10am
An update...
 
When I stop the server and then run the page again it does reload to the correct image at that time.  Obviously this is not a solution as I cannot stop the server each time a user runs the report but figured I would let everyone know what I am seeing.
IP IP Logged
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Posted: 26 Sep 2011 at 4:52am
Well, I did get it to work but did not use the OLE Object method.
 
I save the picture from the database to a jpg, convert this to a bmp and save that to a dataset.  Add the dataset to the report and move the field on to the report and everything works.  Formatting is a little strange because each of my pictures can be a different size but overall it works exaclty as I need.
 
I can give more information on why I did it this way or exactly how I did it if anyone wants it.
IP IP Logged
CircleD
Senior Member
Senior Member
Avatar

Joined: 11 Mar 2011
Location: United States
Online Status: Offline
Posts: 251
Quote CircleD Replybullet Posted: 26 Sep 2011 at 7:54am
I'm not sure if you can do this the way your having to work around your problem but you should be able to  select the object,open the "Format Editor" and click the "Picture" tab,then you can either choose to scale the object to the correct size or enter the "width" and "height" in inches you want to resize the image to. Click OK when you're done.This will resize the picture and make all of them the same size.
IP IP Logged
Enzyme80
Newbie
Newbie


Joined: 19 Jan 2007
Location: United States
Online Status: Offline
Posts: 27
Quote Enzyme80 Replybullet Posted: 26 Sep 2011 at 10:07am
Thanks CircleD, resizing did help some.  Still not perfect but it is so close I am happy with it.
IP IP Logged
hmansoor
Newbie
Newbie
Avatar

Joined: 10 Jan 2010
Location: United Arab Emirates
Online Status: Offline
Posts: 1
Quote hmansoor Replybullet Posted: 26 Sep 2013 at 11:46pm
I dont understand, can you kindly explain in detail, i am stuck with a similar issue
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.