Mega Code Archive

 
Categories / Delphi / Examples
 

Error mismatch in datapacket

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;