Server Error in '/' Application.

DataTable must be set prior to using DataView.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.DataException: DataTable must be set prior to using DataView.

Source Error:


Line 43: 
Line 44:         myDataView.RowFilter = ("TimePosted > '" & PrevDate & "'")
Line 45:         myDataView.Sort = ("votesup desc")
Line 46:         Current.Cache.Insert("cacheTOPPICScount", myDataView.Count, Nothing, expiretime, TimeSpan.Zero)
Line 47:         Current.Cache.Insert("cacheTOPPICS", myDataView.ToTable(), Nothing, expiretime, TimeSpan.Zero)

Source File: D:\sites\dailyhaha-2015\App_Code\toprated.vb    Line: 45

Stack Trace:


[DataException: DataTable must be set prior to using DataView.]
   System.Data.DataView.CheckSort(String sort) +2216468
   System.Data.DataView.set_Sort(String value) +164
   topratedcache.cacheTOPPICS() in D:\sites\dailyhaha-2015\App_Code\toprated.vb:45
   topratedcache.ManageTopRated() in D:\sites\dailyhaha-2015\App_Code\toprated.vb:8
   ASP._404s_pictures_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:\sites\dailyhaha-2015\404s\pictures.aspx:73
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +276
   System.Web.UI.Page.Render(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4239


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4682.0