foreach (Users item in list)
{
   if (item.Corporation.Searches.Contains(StockInfoCorporation))
   {
     ret.Add(item);
   }
                    }如果存在一个Null就报
未将对象引用设置到对象的实例。
但是又必须用包含这类的方法 
求帮助....
谢谢

解决方案 »

  1.   

    sql :  where 字段  is not null
      

  2.   


    create table TB(col int,col1 varchar(20))
    insert  TB
    select 1,'asdf' union all
    select 2,null union all
    select null,'bbb' union all
    select null,'ccccc' union all
    select 3,null union all
    select 6,'31321' union all
    select null,''select col=isnull(col,0),
    col1=isnull(col1,'')
    from tb/*
    col         col1
    ----------- --------------------
    1           asdf
    2           
    0           bbb
    0           ccccc
    3           
    6           31321
    0           (7 行受影响)*/drop table TB
      

  3.   

    if (row["Cost"] != DBNull.Value 
    {
    ...
    }
      

  4.   

    谢谢各位大大 我在在线试
    我用的是Lambda表达式..