<div dir="ltr">Thanks for all. Sorry my insistence. <br><br>Please see this code, it is original, it is in <br><a href="http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681">http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681</a><br>
<br>See, here, line 161:<br><table class="diff noWrapping unifiedDiff" cellspacing="0"><tbody><tr></tr><tr><td class="diffLineNumbersB">161</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">
          GraphExt :=  s.ReadAnsiString;</td></tr></tbody></table><br>My picture is a jpeg image saved on a firebird database.<br>GraphExt do not receive the extension as expected. <br>So, this code never executed becose gc is never assigned in<br>
"gc := GetGraphicClassForFileExtension(GraphExt);":<br><br><table class="diff noWrapping unifiedDiff" cellspacing="0"><tbody><tr></tr><tr><td class="lineContent diffContentB">          if assigned(gc) then</td></tr>
<tr><td class="lineContent diffContentB">            begin</td></tr><tr><td class="lineContent diffContentB">            AGraphic := gc.Create;</td></tr><tr><td class="lineContent diffContentB">            AGraphic.LoadFromStream(s);</td>
</tr><tr><td class="lineContent diffContentB"><br>
</td></tr><tr><td class="lineContent diffContentB">            Picture.Assign(AGraphic);</td></tr><tr><td class="lineContent diffContentB">            end;</td></tr></tbody></table><br><br>==================================<br>
<table class="diff noWrapping unifiedDiff" cellspacing="0"><tbody><tr><td class="diffMarkerColB"><span class="textAddMarker"></span><br></td><td class="lineContent diffContentB"><br></td></tr>
   


 
     
    
    
    
    

    
     
    
   

  
  
      <tr><td class="diffNav"><br></td><td class="diffLineNumbers">88</td><td class="diffLineNumbers">132</td><td class="diffMarkerCol"> </td><td class="lineContent diffContent">procedure TDBImage.LoadPicture;</td></tr>
   


 
     
    
    
    
     
    
    

    
     
    
   

  
  
      <tr><td class="diffNav"><a name="seg8"></a><a href="http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681#seg7" title="Previous Change"><img src="http://fpc64.firmos.at:8060/static/jzt83v/images/upArrow.gif" alt="<" width="9" height="13"></a><a href="http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681#seg9" title="Next Change"><img src="http://fpc64.firmos.at:8060/static/jzt83v/images/downArrow.gif" alt=">" width="9" height="13"></a></td>
<td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">133</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB"><br></td></tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">134</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">var s        : Tstream;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">135</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    GraphExt : string;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">136</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    gc       : TGraphicClass;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">137</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    AGraphic : TGraphic;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">138</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    </td>
</tr>
   


 
     
    
    
    
    

    
     
    
   

  
  
      <tr><td class="diffNav"><br></td><td class="diffLineNumbers">89</td><td class="diffLineNumbers">139</td><td class="diffMarkerCol"> </td><td class="lineContent diffContent">begin</td></tr>
   


 
     
    
    
    
     
    
    

    
     
    
   

  
  
      <tr><td class="diffNav"><a name="seg9"></a><a href="http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681#seg8" title="Previous Change"><img src="http://fpc64.firmos.at:8060/static/jzt83v/images/upArrow.gif" alt="<" width="9" height="13"></a><a href="http://fpc64.firmos.at:8060/browse/Lazarus/trunk/lcl/include/dbimage.inc?r1=9243&r2=10681#seg10" title="Next Change"><img src="http://fpc64.firmos.at:8060/static/jzt83v/images/downArrow.gif" alt=">" width="9" height="13"></a></td>
<td class="diffLineNumbersA">90</td><td class="diffLineNumbersA"> </td><td class="diffMarkerColA"><span class="textDelMarker">-</span></td><td class="lineContent diffContentA">  if not FPictureLoaded</td></tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersA">91</td><td class="diffLineNumbersA"> </td><td class="diffMarkerColA"><span class="textDelMarker">-</span></td><td class="lineContent diffContentA">  and (not Assigned(FDataLink.Field) or FDataLink.Field.IsBlob) then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersA">92</td><td class="diffLineNumbersA"> </td><td class="diffMarkerColA"><span class="textDelMarker">-</span></td><td class="lineContent diffContentA">    Picture.Assign(FDataLink.Field);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">140</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">  if not FPictureLoaded then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">141</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">142</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    FUpdatingRecord := True;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">143</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    if not assigned(FDatalink.Field) then Picture.Assign(FDatalink.Field)</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">144</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    else</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">145</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    if FDatalink.field.IsBlob then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">146</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">      begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">147</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">      if FDatalink.field is TBlobField then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">148</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">149</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        if FDatalink.Field.IsNull then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">150</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">151</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          Picture.Clear;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">152</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          exit;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">153</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          end;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">154</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        s := FDataLink.DataSet.CreateBlobStream(FDataLink.Field,bmRead);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">155</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        if s.Size = 0 then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">156</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">157</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          Picture.Clear;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">158</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          exit;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">159</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          end;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">160</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        try</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">161</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          GraphExt :=  s.ReadAnsiString;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">162</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB"><br></td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">163</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          gc := GetGraphicClassForFileExtension(GraphExt);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">164</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          if assigned(gc) then</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">165</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">            begin</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">166</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">            AGraphic := gc.Create;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">167</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">            AGraphic.LoadFromStream(s);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">168</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB"><br></td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">169</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">            Picture.Assign(AGraphic);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">170</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">            end;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">171</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        finally</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">172</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          if assigned(AGraphic) then AGraphic.Free;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">173</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">          s.Free;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">174</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        end {try}</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">175</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB"><br></td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">176</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        end</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">177</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">      else</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">178</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        Picture.Assign(FDataLink.FField);</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">179</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">        </td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">180</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">      end;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">181</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    FUpdatingRecord := False;</td>
</tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbersB"> </td><td class="diffLineNumbersB">182</td><td class="diffMarkerColB"><span class="textAddMarker">+</span></td><td class="lineContent diffContentB">    end;</td>
</tr>
   


 
     
    
    
    
    

    
     
    
   

  
  
      <tr><td class="diffNav"><br></td><td class="diffLineNumbers">93</td><td class="diffLineNumbers">183</td><td class="diffMarkerCol"> </td><td class="lineContent diffContent">end;</td></tr>
   


  

  
  
      <tr><td class="diffNav"> </td><td class="diffLineNumbers">94</td><td class="diffLineNumbers">184</td><td class="diffMarkerCol"> </td><td class="lineContent diffContent"><br></td></tr></tbody></table><br>==================================<br>
<br><div class="gmail_quote">2008/9/6 Felipe Monteiro de Carvalho <span dir="ltr"><<a href="mailto:felipemonteiro.carvalho@gmail.com">felipemonteiro.carvalho@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If you want to convert raw data to a string you should assign the<br>
stream holding the data to a TStringStream.<br>
<br>
ReadAnsiString can only read data written with WriteAnsiString (or if<br>
you took care to imitate it's format).<br>
<br>
--<br>
<font color="#888888">Felipe Monteiro de Carvalho<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br>
<a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>