Pages

Wednesday, June 8, 2011

OleAut date did not convert to a DateTime Correctly

Some times I at least make stupid mistakes that generate errors that don't generate any search results in Google.

Today this happened while porting to C# a Powershell script I had written that generates some Charts showing VMware View statistics. While trying to use "DataManipulator.InsertEmptyPoints"  I have the following code:

Chart_ViewSessions.DataManipulator.InsertEmptyPoints(1, IntervalType.Hours, "*");

When Run in debugger it was throwing the following System.ArgumentException.

"OleAut date did not convert to a DateTime correctly."

I tested the Powershell and it runs fine so searched Google but nothing with that error really came up. If I  comment the line out and everything runs but doesn't stack the columns correctly as the Chart is a StackedColumn. After about 10 minutes with no luck i finally realize I added the data points after the I had called InsertEmptyPoints. The problem all along was because I had it trying to Convert a DateTime on No Data Points.

So here a reminder to stop and think about the order your doing things if the error doesn't make sense.

No comments:

Post a Comment

Please leave a comment; someone, anyone!