I am trying to create an in-memory dataset. Initially this dataset will be populated from a feeder database, but once I have the data, I will close the connection and work completely with the in-memory dataset, saving it to a session variable as needed. When preparing the data for the charts, I need to do various SELECT statements on my dataset tables. How do you execute a SELECT statement on a dataset table that doesn't have any connection to an actual database?
Take a look at this MSDN article on using DataViews http://msdn.microsoft.com/en-us/library/system.data.dataview.aspx This should be the missing piece you're looking for.
Yes, I think that LINQ TO DATASETS is what I need. Thank you.
This may not be the right place for this, but when I tried the LINQ on my VB2008 Vista-32-bit-business, I get an error. If you happen to know what the problem may be, please let me know.
--------------------------------
Below is my code, along with the runtime error it produces. Does anyone have some suggestions for eliminating the error?------------------- Dim cht1tbl = MetDs.Tables("Charts").AsEnumerable
Dim query = _ From d In cht1tbl.AsEnumerable _ Select d!Jan_2006, d!Feb_2006
Dim cht1View As New DataView cht1View = query.AsQueryable
-------------------
System.InvalidCastException was unhandled by user code Message="Unable to cast object of type 'System.Linq.EnumerableQuery`1[VB$AnonymousType_0`2[System.Object,System.Object]]' to type 'System.Data.DataView'." Source="App_Web_fuzhh4da" StackTrace: at _Default.LoadGrdData() in C:\Users\Paul\Documents\Visual Studio 2008\WebSites\TestGrid\Default.aspx.vb:line 33 at _Default.Page_Load(Object sender, EventArgs e) in C:\Users\Paul\Documents\Visual Studio 2008\WebSites\TestGrid\Default.aspx.vb:line 17 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException:
Take a look at this thread on the ASP.NET forums - http://forums.asp.net/t/1226738.aspx
You can't create a DataView from anonymous types, or from a Linq query that performs a Join. There are a couple of links in the thread which may provide some help for you.
-Tony
This was the linq (pun intended!!) that I needed:
http://msdn.microsoft.com/en-us/library/bb669096.aspx