Jump to content
Software FX Community

Can't dynamically bind DataSet


User (Legacy)

Recommended Posts

I have very simple code that creates dataset and tries to bind it to Chart

FX.

But I have - "No Data Available".

What is wrong with my code?

DataSet DS = new DataSet();

DataTable dt = new DataTable();

dt.Columns.Add("Col 1");

dt.Columns.Add("Col 2");

for( int i = 1; i <= 10; i++ )

{

DataRow row = dt.NewRow();

row["Col 1"] = i;

row["Col 2"] = i;

dt.Rows.Add(row);

}

DS.Tables.Add(dt);

Chart1.DataSource = DS.Tables[0];

Chart1.DataBind();

I Also tried to use

Chart1.DataSourceSettings.DataSource = DS.Tables[0];

But result is the same.

Regards,

Sergei.

Link to comment
Share on other sites

It works!

Thank you very much!

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:KsaT3r15CHA.2116@webserver1.softwarefx.com...

> The problem here is that you are not specifying the types of the columns.

> For example:

>

> dt.Columns.Add("Col 1",typeof(int));

>

> dt.Columns.Add("Col 2",typeof(int));

>

>

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...