Jump to content
Software FX Community

System.ArgumentException: Not a legal OleAut date


User (Legacy)

Recommended Posts

I am coding a self contained C# page to create a chart.. this is my first

run at this and I seem to be close.... it is the very last line of code that

is throwing this error. Here is the line that is throwing the error:

<%= Chart1.GetHtmlTag(500,350)%>

Any ideas on this? Could it have something to do with the data result set

that I am bringing back from Sql Server?

Thanks,

Derek

Link to comment
Share on other sites

It would appear that one of the dates you are using is not in a legal

format.

The source code which put the whole enchilada together is GetHtmlTag.

It is not that line specifically that is failing rather something with the

date you are using from Sql Server that is crashing.

We have written extensively about how to pass data to ChartFX in the correct

format in our Programmers Guide/Resource Center.

To illustrate the problem don't pass data to ChartFX and it will generate

Random Data. It should display a chart!

If you cannot solve the problem, post your source code here and the data you

are passing to the chart and we can take a look.

-CJS

"Derek Feagin" <ddfeagi@nppd.com> wrote in message

news:7k5iLFbFEHA.200@webserver3.softwarefx.com...

> I am coding a self contained C# page to create a chart.. this is my first

> run at this and I seem to be close.... it is the very last line of code

that

> is throwing this error. Here is the line that is throwing the error:

>

> <%= Chart1.GetHtmlTag(500,350)%>

>

> Any ideas on this? Could it have something to do with the data result set

> that I am bringing back from Sql Server?

>

> Thanks,

> Derek

>

>

Link to comment
Share on other sites

I added a line to my code:

Chart1.Gallery = Gallery.Lines;

and now it just generates a blank chart - no x,y no title nothing.

The chart that we are basically trying to duplicate with the ChartFX

software I have attached. Here is the code that I am currently using in the

C# page... (keep in mind .net and c# are new to me so there are probably

better ways for me to do things that I am unaware of...)

<%@ Page language="c#"%>

<%@ IMPORT Namespace="SoftwareFX.ChartFX"%>

<%@ IMPORT Namespace="SoftwareFX.ChartFX.Borders"%>

<%@ IMPORT Namespace="SoftwareFX.ChartFX.Internet.Server"%>

<%@ IMPORT Namespace="System"%>

<%@ IMPORT Namespace="System.Web"%>

<%@ IMPORT Namespace="System.Drawing"%>

<%@ IMPORT Namespace="System.Data"%>

<%@ IMPORT Namespace="System.Data.SqlClient"%>

<%

System.DateTime strStartDate;

System.DateTime strEndDate = System.DateTime.Now;

strStartDate = strEndDate.AddDays(-1);

String strStartDate1 = strStartDate.Month + "/" + strStartDate.Day + "/" +

strStartDate.Year;

String strEndDate1 = strEndDate.Month + "/" + strEndDate.Day + "/" +

strEndDate.Year;

System.Data.SqlClient.SqlConnection myConnection = new

System.Data.SqlClient.SqlConnection("server=sqlserver;database=runtime; User

Id=foo;password=foo");

String strSQL = "SELECT DateTime AS DT, Value = ah.Value FROM

v_AnalogHistory ah WHERE ah.TagName in ('WTR_Sutherland_Lake_Elev') AND

wwRetrievalMode = 'Cyclic' AND wwResolution = 300000 AND wwVersion =

'LATEST' AND DateTime >= " + strStartDate1 + " AND DateTime <= " +

strEndDate1 + " UNION SELECT DateTime, Value = ah.Value FROM

ManualAnalogHistory ah WHERE ah.TagName in ('WTR_Suth_Res_Elev') AND

DateTime >= " + strStartDate1 + " AND DateTime <= " + strEndDate1 + " ORDER

BY DateTime DESC";

SqlDataAdapter myCommand = new SqlDataAdapter(strSQL, myConnection);

DataSet dsSales = new DataSet();

myCommand.Fill(dsSales, "v_AnalogHistory");

Chart Chart1 = new Chart(this);

Chart1.Gallery = Gallery.Lines;

Chart1.AxisX.Title.Text = "Time";

Chart1.AxisY.Title.Text = "Elevation (Feet)";

Chart1.DataSource = dsSales.Tables[0];

%>

<%= Chart1.GetHtmlTag(500,350)%>

Thanks for your help!

Derek

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

news:sn4fnabFEHA.2432@webserver3.softwarefx.com...

> It would appear that one of the dates you are using is not in a legal

> format.

> The source code which put the whole enchilada together is GetHtmlTag.

> It is not that line specifically that is failing rather something with the

> date you are using from Sql Server that is crashing.

> We have written extensively about how to pass data to ChartFX in the

correct

> format in our Programmers Guide/Resource Center.

> To illustrate the problem don't pass data to ChartFX and it will generate

> Random Data. It should display a chart!

>

> If you cannot solve the problem, post your source code here and the data

you

> are passing to the chart and we can take a look.

>

> -CJS

>

> "Derek Feagin" <ddfeagi@nppd.com> wrote in message

> news:7k5iLFbFEHA.200@webserver3.softwarefx.com...

> > I am coding a self contained C# page to create a chart.. this is my

first

> > run at this and I seem to be close.... it is the very last line of code

> that

> > is throwing this error. Here is the line that is throwing the error:

> >

> > <%= Chart1.GetHtmlTag(500,350)%>

> >

> > Any ideas on this? Could it have something to do with the data result

set

> > that I am bringing back from Sql Server?

> >

> > Thanks,

> > Derek

> >

> >

>

>

Link to comment
Share on other sites

I thought I would also supply this ... this is a spreadsheet that shows what

the data looks like when it is called from Excel.

- Derek

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

news:sn4fnabFEHA.2432@webserver3.softwarefx.com...

> It would appear that one of the dates you are using is not in a legal

> format.

> The source code which put the whole enchilada together is GetHtmlTag.

> It is not that line specifically that is failing rather something with the

> date you are using from Sql Server that is crashing.

> We have written extensively about how to pass data to ChartFX in the

correct

> format in our Programmers Guide/Resource Center.

> To illustrate the problem don't pass data to ChartFX and it will generate

> Random Data. It should display a chart!

>

> If you cannot solve the problem, post your source code here and the data

you

> are passing to the chart and we can take a look.

>

> -CJS

>

> "Derek Feagin" <ddfeagi@nppd.com> wrote in message

> news:7k5iLFbFEHA.200@webserver3.softwarefx.com...

> > I am coding a self contained C# page to create a chart.. this is my

first

> > run at this and I seem to be close.... it is the very last line of code

> that

> > is throwing this error. Here is the line that is throwing the error:

> >

> > <%= Chart1.GetHtmlTag(500,350)%>

> >

> > Any ideas on this? Could it have something to do with the data result

set

> > that I am bringing back from Sql Server?

> >

> > Thanks,

> > Derek

> >

> >

>

>

Link to comment
Share on other sites

ok... we found another problem... I needed to wrap my dates that I passed

into the SQL statement with single quotes... now I am getting data to the

chart... I have also set a TOP 30 in the SQL statement so I can just get a

small subset of the data that is coming back... it is giving me an autoscale

that runs from 0 to 3000. All of the numbers that are coming back are

hovering around 3500 so it is looking like a flat line. Should the chart

autoscale so that we can see the definition?

Thanks again!

Derek

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

news:sn4fnabFEHA.2432@webserver3.softwarefx.com...

> It would appear that one of the dates you are using is not in a legal

> format.

> The source code which put the whole enchilada together is GetHtmlTag.

> It is not that line specifically that is failing rather something with the

> date you are using from Sql Server that is crashing.

> We have written extensively about how to pass data to ChartFX in the

correct

> format in our Programmers Guide/Resource Center.

> To illustrate the problem don't pass data to ChartFX and it will generate

> Random Data. It should display a chart!

>

> If you cannot solve the problem, post your source code here and the data

you

> are passing to the chart and we can take a look.

>

> -CJS

>

> "Derek Feagin" <ddfeagi@nppd.com> wrote in message

> news:7k5iLFbFEHA.200@webserver3.softwarefx.com...

> > I am coding a self contained C# page to create a chart.. this is my

first

> > run at this and I seem to be close.... it is the very last line of code

> that

> > is throwing this error. Here is the line that is throwing the error:

> >

> > <%= Chart1.GetHtmlTag(500,350)%>

> >

> > Any ideas on this? Could it have something to do with the data result

set

> > that I am bringing back from Sql Server?

> >

> > Thanks,

> > Derek

> >

> >

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...