Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

System.ArgumentOutOfRangeException: DateTime.

I am getting the following error when I go to run my application.  I am trying to graph a value vs DateTime.  The DateTime and value are stored in a database.
 
Error:
 
System.ArgumentOutOfRangeException: Only double values within a range of 0, or DateTime.MinValue, to 315537897599, or DateTime.MaxValue, can be converted to DateTime.
Parameter name: source
 
My code:

Dim start As DateTime

Dim finish As DateTime

Dim increment As TimeSpan

start = Session(

"periodStartSpanDTM")

finish = Session(

"periodEndSpanDTM")

increment = TimeSpan.FromMinutes(30)

Dim xAxis As XAxis = graph.XAxes(0)

Dim yAxis As YAxis = graph.YAxes(0)

xAxis.Mode = AxisMode.Fixed

xAxis.AutoSpacing =

False

xAxis.MajorDivisions.Base =

CType(DataConverter.Convert(start, GetType(Double)), Double)

xAxis.MajorDivisions.Interval =

CType(DataConverter.Convert(TimeSpan.FromDays(1), GetType(Double)), Double)

xAxis.MinorDivisions.Interval =

CType(DataConverter.Convert(TimeSpan.FromHours(1), GetType(Double)), Double)

xAxis.Range =

New Range(CType(DataConverter.Convert(start, GetType(Double)), Double), CType(DataConverter.Convert(finish, GetType(Double)), Double))

Dim Label As String = ddlLabels.SelectedItem.Text.ToString

Dim Units As String = ddlLabels.SelectedValue.ToString

Dim Points As Double

Dim rtimes As DateTime

Dim Time As Double

Dim myConn As OleDbConnection = New OleDbConnection("ConnectionString")

Dim myCmd As OleDbCommand = New OleDbCommand("Query Statement", myConn)

myConn.Open()

Dim aReader As OleDbDataReader = myCmd.ExecuteReader()

While aReader.Read

Points =

CDbl(aReader("value"))

rtimes = aReader(

"acqGMT")

Time =

CDbl(DataConverter.Convert(rtimes, GetType(Double)))

ls.Text +=

"Value(" & aReader("acqGMT") & "): " & aReader("value") & "<Br />"

graph.PanXY(Time, Points)

End While

myConn.Close()


0 Kudos
Message 1 of 2
(3,629 Views)
Please follow David's advice in the duplicate forum here.

In the future, it may be better to keep all forum posts to one thread rather than having multiple threads about the same issue. This way there is only one place that people will go to help you out on the subject.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 2
(3,615 Views)