Jump to content
Software FX Community

Input string was not in a correct format


kenny70
 Share

Recommended Posts

I am getting the following stack trace when trying to view a bar chart that has multiple series:

System.FormatException was unhandled by user code  Message="Input string was not in a correct format."  Source="mscorlib"  StackTrace: at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info) at System.Double.Parse(String s, IFormatProvider provider) at ChartFX.WebForms.DataSourceSettings.a(TypeCode A_0, Object A_1) at ChartFX.WebForms.DataSourceSettings.a(IDataEx A_0, FieldMapCollection A_1, PropertyDescriptorCollection A_2, b A_3, Boolean A_4) at ChartFX.WebForms.DataSourceSettings.a() at ChartFX.WebForms.DataSourceSettings.e() at ChartFX.WebForms.DataSourceSettings.set_DataSource(Object value) at compStratification.FillChart() in D:\webNET\rmeds\compStratification.aspx.vb:line 179 at compStratification.Page_Load(Object sender, EventArgs e) in D:\webNET\Stratification.aspx.vb:line 57 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

My query I run is:SELECT 'X-Axis' = s.mfr_code, 'Flight Expended' = count(case S.varcode when 'R' then S.varcode end), 'Test Expended' = count(case S.varcode when 'Y' then S.varcode end), 'Non-Installed' = count(case when S.varcode NOT IN ('R', 'Y') then case when C.final_key_no is null then S.varcode end end), 'Installed' = count(case when S.varcode NOT IN ('R', 'Y') then case when C.final_key_no is not null then S.varcode end end) FROM STATUS S left join CDL_ITEM I on I.key_no=S.key_no and I.event_date=(select max(event_date) from CDL_ITEM where key_no=S.key_no) left join CDL C on I.final_key_no=C.final_key_no and I.final_event_date=C.final_event_date where S.name_abbr = 'GUD' Group BY s.mfr_code ORDER BY s.mfr_code

s.mfr_code has a datatype of char(3)I then try to input the values into the chart by:

chrtCompStrat.DataSourceSettings.Fields.Clear()chrtCompStrat.DataSourceSettings.Fields.Add(

New FieldMap("X-Axis", FieldUsage.XValue))chrtCompStrat.DataSourceSettings.Fields.Add(New FieldMap("Installed", FieldUsage.Value))chrtCompStrat.DataSourceSettings.Fields.Add(New FieldMap("Non-Installed", FieldUsage.Value))chrtCompStrat.DataSourceSettings.Fields.Add(New FieldMap("Flight Expended", FieldUsage.Value))chrtCompStrat.DataSourceSettings.Fields.Add(New FieldMap("Test Expended", FieldUsage.Value))chrtCompStrat.DataSourceSettings.DataSource = dsChrtData.Tables(0)

The weird thing is when my query is:SELECT 'X-Axis' = case S.varcode when 'R' then isnull(convert(char(5),DATEDIFF(year, S.mfr_date, S.event_date)), 0) when 'Y' then isnull(convert(char(5),DATEDIFF(year, S.mfr_date, S.event_date)), 0) else isnull(convert(char(5),DATEDIFF(year, isnull(S.mfr_date, getdate()), getdate())), 0) end, 'Flight Expended' = count(case S.varcode when 'R' then S.varcode end), 'Test Expended' = count(case S.varcode when 'Y' then S.varcode end), 'Non-Installed' = count(case when S.varcode NOT IN ('R', 'Y') then case when C.final_key_no is null then S.varcode end end), 'Installed' = count(case when S.varcode NOT IN ('R', 'Y') then case when C.final_key_no is not null then S.varcode end end), 'SortOrder' = case S.varcode when 'R' then isnull(DATEDIFF(year, S.mfr_date, S.event_date),'') when 'Y' then isnull(DATEDIFF(year, S.mfr_date, S.event_date),'') else isnull(DATEDIFF(year, isnull(S.mfr_date, getdate()), getdate()),'') end FROM STATUS S left join CDL_ITEM I on I.key_no=S.key_no and I.event_date=(select max(event_date) from CDL_ITEM where key_no=S.key_no) left join CDL C on I.final_key_no=C.final_key_no and I.final_event_date=C.final_event_date where S.name_abbr = 'GUD' Group BY case S.varcode when 'R' then isnull(convert(char(5),DATEDIFF(year, S.mfr_date, S.event_date)), 0) when 'Y' then isnull(convert(char(5),DATEDIFF(year, S.mfr_date, S.event_date)), 0) else isnull(convert(char(5),DATEDIFF(year, isnull(S.mfr_date, getdate()), getdate())), 0) end, case S.varcode when 'R' then isnull(DATEDIFF(year, S.mfr_date, S.event_date),'') when 'Y' then isnull(DATEDIFF(year, S.mfr_date, S.event_date),'') else isnull(DATEDIFF(year, isnull(S.mfr_date, getdate()), getdate()),'') end ORDER BY 'SortOrder'

Where S.mfr_date and S.event_Date are smalldatetime, I have no problems.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...