如何在SQL Server中创建一个类似于where的子句?
我自己做了一个,但任何人都可以改进吗?
public List<State> Wherein(string listofcountrycodes)
{
string[] countrycode = null;
countrycode = listofcountrycodes.Split(',');
List<State> statelist = new List<State>();
for (int i = 0; i < countrycode.Length; i++)
{
_states.AddRange(
from states in _objdatasources.StateList()
where states.CountryCode == countrycode[i].ToString()
select new State
{
StateName = states.StateName
});
}
return _states;
}
子衿沉夜
慕容708150
泛舟湖上清波郎朗
相关分类