How to save/load a chart template from a database ?
Posted: Thu Dec 07, 2006 5:36 pm
Hello,
I would like to know what is the best practice for saving/loading a chart template into a Database field (Sql Server in the case in point). What type of field use in the Db (varbinary ?).
I've done some tests but if the save job work good the load one always throw a exception because of a Truncate stream when using TeeChart.Import.Load().
The Load code :
where GraphLayout is a Byte[] array readed from the db.
The Save code:
I would like to know what is the best practice for saving/loading a chart template into a Database field (Sql Server in the case in point). What type of field use in the Db (varbinary ?).
I've done some tests but if the save job work good the load one always throw a exception because of a Truncate stream when using TeeChart.Import.Load().
The Load code :
Code: Select all
System.IO.MemoryStream _stream = new System.IO.MemoryStream(GraphLayout);
this.tChart1.Import.Template.Load(_stream);
The Save code:
Code: Select all
System.IO.MemoryStream _stream = new System.IO.MemoryStream();
this.tChart1.Export.Template.Save(_stream);
GraphLayout = _stream.GetBuffer();