Page 1 of 1

Webchart problems in Delphi2005

Posted: Thu Feb 16, 2006 6:10 pm
by 9637231
I tried to get webchart working in Delphi2005. I think we have to rewrite the Getchart.aspx.cs into Delphi.

private void Page_Load(object sender, System.EventArgs e)
{
string chartName=Request.QueryString["Chart"];
if (Session[chartName]!=null)
{
MemoryStream chartStream = new MemoryStream();
chartStream=((MemoryStream)Session[chartName]);
Response.OutputStream.Write(chartStream.ToArray(),0,(int)chartStream.Length);
chartStream.Close();
Session.Remove(chartName);
}
}

Is someone able to translate it into Delphi language?

It should like :

procedure TGetchart.Page_Load(sender: System.Object; e: System.EventArgs);
Var Chartname : String;
ChartStream : Memorystream;
begin
chartName:=Request.QueryString['Chart'];
if (Session[chartName]=nil) then begin
Chartstream:=Memorystream.Create;
Chartstream.Read(Session[chartName]);
Response.OutputStream.Write(chartStream.ToArray), 0,chartStream.Length);
chartStream.Close;
end;
Session.Remove(chartName);
end;

But the chartstream lines are wrong.

Thanks,
Hans

Posted: Fri Feb 17, 2006 11:15 am
by narcis
Hi Hans,

This is the GetChart code in Delphi:

Code: Select all

procedure TWebForm2.Page_Load(sender: System.Object; e: System.EventArgs);
var
  chartName: String;
  chartStream: MemoryStream;
begin
  chartName := Request.QueryString['Chart'];
  if (Session[chartName] <> nil) then
  begin
    chartStream := System.IO.MemoryStream.Create;
    chartStream := (System.IO.MemoryStream(Session[chartName]));
    Response.OutputStream.Write(chartStream.ToArray, 0, (Integer(chartStream.Length)));
    chartStream.Close;
    Session.Remove(chartName);
  end;
end;
In those cases, it may be of great help using Borland’s BabelCode Client.