Главная страница | назад





Article #16560: Error: 'Mismatch in datapacket'

 Question and Answer Database

FAQ1560D.txt   Error: 'Mismatch in datapacket'
Category   :Multitier/Remote Datasets
Platform    :All
Product    :Delphi 3.x  

Question:
When I use LoadFromStream on the TClientDataSet, 
I receive an EDBClient exception "Mismatch in datapacket".

Answer:
You may not be reseting the position of the stream.  
This procedure works...

var  
Stream: TMemoryStream;
begin
  Stream := TMemoryStream.Create;
  try
    CDS.SaveToStream(Stream);
    // Reset to the beginning of the data packet.
    // Forgetting this step is one way to produce the error.
    Stream.Position := 0;  
    CDS.LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;

7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99