Querying DataTable

I have a datatable which contains yearly data saved. e.g.

dtDate                      Value
2010-01-01 00:00:00.000     5.0000
2011-01-01 00:00:00.000     15.0000
2012-01-01 00:00:00.000     25.0000
2013-01-01 00:00:00.000     35.0000
2014-01-01 00:00:00.000     45.0000

Now i want to use this datatable for monthly process. so for all months in year 2010 i want to use value=5. e.g. If my date is 02/01/2010 Feb 2010 it should return me

How do I use datatable.select method? I want some effective filter expression.

Answers


The DataTable.Select(filterExpression) overload method contains the parameter filterExpression that use the same syntax used to create calculated columns via the Expression property.

You could use this code to get required row

Dim dt as DateTime dt = new DateTime(2010,1,1,0,0,0)
Dim r as DataRow() r = DataTable.Select("dtDate = #" + dt.ToString("yyyy-MM-dd") + "#");

If your intention is to get the record for year 2010 passing any date with year = 2010 then you could use this syntax

' Supposing date passed is 1/May/2010 and you want the record with 2010 as year.
Dim dt as DateTime dt = new DateTime(2010,5,1,0,0,0)  
Dim r as DataRow() r = DataTable.Select("dtDate = #01/01/" + dt.Year.ToString()) + "#");

Need Your Help

libvirt with xen server

xen libvirt

I want to use libvirt with Xen-Server (not Xen-project). When I invoke the command 'virsh', I get the following error :

Stop setInterval

javascript jquery html setinterval

I want to stop this interval in the error handler from running repeatedly. Is that possible, and if so, how?