So, I work in a company where there are several tables with different names, but exactly the same structure (date, time, value). I would like my program (C # or LINQ / LINQPad) to go through these tables and query for a specific row, so I can make sure all of them have been updated properly. Is this doable?
So far I have been thinking about this. Knowing that each table name will give it a different class, I try to generally get the values ββfrom the table. I can get the table using the code here
DataContext dc = new DataContext(); var myTable = (ITable)dc.GetType().GetProperty("Table").GetValue(dc, null);
My problem is that I am trying to get columns from this table using a similar method. However, the error below appears:
foreach(var e in myTable) { double myValue = (double)e.GetType().GetProperty("Value").GetValue(e, null); }
So, when I looked at all the properties of e.GetType (), I noticed that it had 2, one of which was Context, so I went there to study. However, the next layer down seems to be a dead end for metadata with no actual data coming out of my loop. Am I even heading in the right direction? Once I get this obstacle, it will be easy for me to make a list and get my results in this way. Any help would be greatly appreciated. Thanks.
source share