开发者

Datatable select concat two columns

开发者 https://www.devze.com 2023-03-02 17:29 出处:网络
I have some data in the datatable there are two columns that are year and month that I need to concat and select the data

I have some data in the datatable there are two columns that are year and month that I need to concat and select the data

it should be some thing like this

DataTable dt;
string expression = 开发者_JS百科(year,month)=(2009,03)
dt.Select(expression);

The above syntax is an example of what I want to achieve .

For further clarification I have the data in data table as

year | Month
2009   03
2010   04
2010   05

So the above select should fetch me one row.


you can get this by

dt.DefaultView.RowFilter = "year='2009' AND Month='03'";

Now dt.DefaultView will return you one row or rows matching your criteria

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号