Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 枚举尚未启动或已完成_C#_Wpf_Dynamic Data Display - Fatal编程技术网

C# 枚举尚未启动或已完成

C# 枚举尚未启动或已完成,c#,wpf,dynamic-data-display,C#,Wpf,Dynamic Data Display,我正在开发一个应用程序,一切正常,但我遇到了一个例外 枚举尚未开始或已完成。 下面是生成此异常的代码 for (int i = 0; i < SelectedItems.Count; i++) { lineDS = new DataSet(); datDs = new DataSet(); datDs = DatelineData(Sel

我正在开发一个应用程序,一切正常,但我遇到了一个例外

枚举尚未开始或已完成。

下面是生成此异常的代码

 for (int i = 0; i < SelectedItems.Count; i++)
                {
                    lineDS = new DataSet();
                    datDs = new DataSet();
                    datDs = DatelineData(SelectedItems[i].ToString(), Starttime, Endtime, NUDTextBox, txtSensorLess, dtpStartDate, dtpEndDate);
                    lineDS =GraphlineDraw(SelectedItems[i].ToString(),Starttime,Endtime,NUDTextBox,txtSensorLess,dtpStartDate,dtpEndDate);
                    if (datDs.Tables[0].Rows.Count > 0 & lineDS.Tables[0].Rows.Count > 0)
                    {
                        var dates = (from dr in datDs.Tables[0].AsEnumerable()
                                     select new
                                     {
                                         date = dr.Field<DateTime>("DateRecorded"),
                                     }.date).ToList();

                        var Rate = (from dr in lineDS.Tables[0].AsEnumerable()
                                    select new
                                    {
                                        rate = dr.Field<double>(SelectedItems[i])
                                    }.rate).ToList();
                        var datesDataSource = new EnumerableDataSource<DateTime>(dates);
                        datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));
                        var RateDataSource = new EnumerableDataSource<double>(Rate);
                        RateDataSource.SetYMapping(y => y);
                        CompositeDataSource compositeDataSourceSenssor = new CompositeDataSource(datesDataSource, RateDataSource);
                        plotter.AddLineGraph(compositeDataSourceSenssor, colors[i], 1, SelectedItems[i]);
                        //Items.Add(new ItemVM((Brush)converter.ConvertFromString(colors[i].ToString()), SelectedItems[i]));
                    }
                    plotter.LegendVisible = false;
                    //listview.ItemsSource = Items;
                }
这是GraphLineDraw方法

  private DataSet GraphlineDraw(string selecteditem, string Starttime, string Endtime, string NUDTextBox, string txtSensorLess, string dtpStartDate, string dtpEndDate)
    {
        try
        {                                              
                SqlParameter colomNamePrm, startdatePrm, EnddatePrm, StartPrm, EndPrm;                                         
                connection = new SqlConnection(settings);
                connection.Open();
                DataSet objds = new DataSet();
                command = new SqlCommand();
                command.Connection = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "getAvgColumn";
                colomNamePrm = new SqlParameter("@ColumnName", SqlDbType.VarChar);
                startdatePrm = new SqlParameter("@StartDate", SqlDbType.VarChar);
                EnddatePrm = new SqlParameter("@EndDate", SqlDbType.VarChar);
                StartPrm = new SqlParameter("@Start", SqlDbType.VarChar);
                EndPrm = new SqlParameter("@End", SqlDbType.VarChar);
                colomNamePrm.Value =selecteditem;
                startdatePrm.Value = dtpStartDate + " " + Starttime;
                EnddatePrm.Value = dtpEndDate + " " + Endtime;
                StartPrm.Value = NUDTextBox;
                EndPrm.Value = txtSensorLess;
                command.Parameters.Add(colomNamePrm);
                command.Parameters.Add(startdatePrm);
                command.Parameters.Add(EnddatePrm);
                command.Parameters.Add(StartPrm);
                command.Parameters.Add(EndPrm);
                adapter.SelectCommand = command;
                adapter.Fill(objds);                    

            return objds;
        }
        catch (Exception ex) { throw ex; }
        finally
        {
            command.Dispose();
            adapter.Dispose();
            connection.Close();
        }
    }
请帮我处理一下急事

更新:异常堆栈跟踪

 at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.System.Collections.IEnumerator.get_Current()
   at Microsoft.Research.DynamicDataDisplay.DataSources.EnumerablePointEnumerator`1.GetCurrent(Point& p)
   at Microsoft.Research.DynamicDataDisplay.DataSources.CompositeDataSource.CompositeEnumerator.GetCurrent(Point& p)
   at Microsoft.Research.DynamicDataDisplay.DataSources.DataSourceHelper.<GetPoints>d__0.MoveNext()
   at Microsoft.Research.DynamicDataDisplay.CoordinateTransformExtensions.<DataToViewport>d__0.MoveNext()
   at Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetDataBounds(IEnumerable`1 points)
  at Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetViewportBounds(IEnumerable`1 dataPoints, DataTransform transform)
  at Microsoft.Research.DynamicDataDisplay.LineGraph.UpdateCore()
 at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.Update()
   at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnOutputChanged(Rect newRect, Rect oldRect)
   at Microsoft.Research.DynamicDataDisplay.LineGraph.OnOutputChanged(Rect newRect, Rect oldRect)
   at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnViewportPropertyChanged(Object sender, ExtendedPropertyChangedEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.RaisePropertyChangedEvent(DependencyPropertyChangedEventArgs e)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata,         EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue,        OperationType operationType)
 at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate        catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate        catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32        numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at IntelOptics_Vicksburg.App.Main() in C:\Documents and Settings\pc\Desktop\24-05-2012PM\Inteloptics Report        Codes\IntelOptics_Reports\IntelliOptics Reports\obj\x86\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
at System.ThrowHelper.ThrowInvalidOperationException(异常资源)
位于System.Collections.Generic.List`1.Enumerator.System.Collections.IEnumerator.get_Current()
在Microsoft.Research.DynamicDataDisplay.DataSources.EnumerablePointEnumerator`1.GetCurrent(Point&p)
位于Microsoft.Research.DynamicDataDisplay.DataSources.CompositeDataSource.CompositeEnumerator.GetCurrent(Point&p)
在Microsoft.Research.DynamicDataDisplay.DataSources.DataSourceHelper.d_u0.MoveNext()中
在Microsoft.Research.DynamicDataDisplay.CoordinateTransformExtensions.d_u0.MoveNext()上
在Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetDataBounds(IEnumerable`1点)
在Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetViewportBounds(IEnumerable`1数据点,数据转换)
在Microsoft.Research.DynamicDataDisplay.LineGraph.UpdateCore()上
在Microsoft.Research.DynamicDataDisplay.ViewportElement2D.Update()上
在Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnOutputChanged(Rect newRect,Rect oldRect)
在Microsoft.Research.DynamicDataDisplay.LineGraph.OnOutputChanged(Rect newRect,Rect oldRect)中
在Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnViewportPropertyChanged(对象发送方,ExtendedPropertyChangedEventArgs e)
在System.EventHandler`1.Invoke处(对象发送方,TEventArgs e)
在Microsoft.Research.DynamicDataDisplay.Viewport2D.RaisePropertyChangedEvent(DependencyPropertyChangedEventArgs e)中
在Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged中(DependencyPropertyChangedEventArgs e)
位于System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs参数)
在System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex EntryIndex,DependencyProperty dp,PropertyMetadata,EffectiveValueEntry oldEntry,EffectiveValueEntry&newEntry,布尔强制WithDeferredReference,布尔强制WithCurrentValue,OperationType OperationType)
位于System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp、对象值、PropertyMetadata元数据、布尔强制WithDeferredReference、布尔强制WithCurrentValue、OperationType OperationType、布尔isInternal)
位于System.Windows.DependencyObject.SetValue(DependencyPropertyKey,对象值)
在Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged中(DependencyPropertyChangedEventArgs e)
位于System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs参数)
位于System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
在Microsoft.Research.DynamicDataDisplay.Viewport2D.OnRenderSizeChanged(SizeChangedInfo sizeInfo)上
位于System.Windows.ContextLayoutManager.fireSizeChangedEvents()处
位于System.Windows.ContextLayoutManager.UpdateLayout()处
位于System.Windows.ContextLayoutManager.UpdateLayoutCallback(对象参数)
位于System.Windows.Media.MediaContext.InvokeRenderCallback.DoWork()处
在System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()中
位于System.Windows.Media.MediaContext.RenderMessageHandlerCore(对象大小调整的CompositionTarget)
位于System.Windows.Media.MediaContext.RenderMessageHandler(对象大小调整的CompositionTarget)
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调、对象参数、Int32 numArgs)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源、委托方法、对象参数、Int32 numArgs、委托catchHandler)
在System.Windows.Threading.DispatcherOperation.InvokeImpl()中
位于System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)
位于System.Threading.ExecutionContext.runTryCode(对象用户数据)
在System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode代码、CleanupCode backoutCode、Object userData)中运行
位于System.Threading.ExecutionContext.RunInternal(ExecutionContext ExecutionContext,ContextCallback回调,对象状态)
在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态,布尔ignoreSyncCtx)
在System.Threading.ExecutionContext.Run(ExecutionContext ExecutionContext,ContextCallback回调,对象状态)
在System.Windows.Threading.DispatcherOperation.Invoke()中
在System.Windows.Threading.Dispatcher.ProcessQueue()中
位于System.Windows.Threading.Dispatcher.WndProcHook(IntPtr-hwnd、Int32-msg、IntPtr-wParam、IntPtr-lParam、Boolean和handled)
在MS.Win32.HwndWrapper.WndProc(IntPtr-hwnd、Int32-msg、IntPtr-wParam、IntPtr-lParam、Boolean和handled)
在MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象o)上
位于System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托回调、对象参数、Int32 numArgs)
位于MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源、委托方法、对象参数、Int32 numArgs、委托catchHandler)
位于System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority优先级、TimeSpan超时、委托方法、对象参数、Int32 numArgs)
位于MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd、Int32 msg、IntPtr wParam、IntPtr lParam)
位于MS.Win32.unsafentivemethods.DispatchMessage(MSG&MSG)
位于System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame框架)
在System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame框架)上
在System.Windows.Threading.Dispatcher.Run()中
位于System.Windows.Application.RunDispatcher(对象忽略)
位于System.Windows.Application.RunInternal(窗口)
在System.Windows.application
 at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.System.Collections.IEnumerator.get_Current()
   at Microsoft.Research.DynamicDataDisplay.DataSources.EnumerablePointEnumerator`1.GetCurrent(Point& p)
   at Microsoft.Research.DynamicDataDisplay.DataSources.CompositeDataSource.CompositeEnumerator.GetCurrent(Point& p)
   at Microsoft.Research.DynamicDataDisplay.DataSources.DataSourceHelper.<GetPoints>d__0.MoveNext()
   at Microsoft.Research.DynamicDataDisplay.CoordinateTransformExtensions.<DataToViewport>d__0.MoveNext()
   at Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetDataBounds(IEnumerable`1 points)
  at Microsoft.Research.DynamicDataDisplay.BoundsHelper.GetViewportBounds(IEnumerable`1 dataPoints, DataTransform transform)
  at Microsoft.Research.DynamicDataDisplay.LineGraph.UpdateCore()
 at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.Update()
   at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnOutputChanged(Rect newRect, Rect oldRect)
   at Microsoft.Research.DynamicDataDisplay.LineGraph.OnOutputChanged(Rect newRect, Rect oldRect)
   at Microsoft.Research.DynamicDataDisplay.ViewportElement2D.OnViewportPropertyChanged(Object sender, ExtendedPropertyChangedEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.RaisePropertyChangedEvent(DependencyPropertyChangedEventArgs e)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata,         EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue,        OperationType operationType)
 at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at Microsoft.Research.DynamicDataDisplay.Viewport2D.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate        catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate        catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32        numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at IntelOptics_Vicksburg.App.Main() in C:\Documents and Settings\pc\Desktop\24-05-2012PM\Inteloptics Report        Codes\IntelOptics_Reports\IntelliOptics Reports\obj\x86\Debug\App.g.cs:line 0
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
if (dates.Count() != Rate.Count())
{
    // serious problem:
    // won't work, since there are X values without Y values or vice versa
}
private DataSet DatelineData(...)
{
    using(var connection = new SqlConnection(settings))
    {
         SqlParameter colomNamePrm, startdatePrm, EnddatePrm, StartPrm, EndPrm;                                        
         connection.Open();
         using (var command = connection.CreateCommand())
         {
             ....
             return dateDs;
         }
    }
}