开发者

removing null valued columns from dataset in asp .net

开发者 https://www.devze.com 2022-12-17 07:12 出处:网络
I have a table which stores data with null valued columns for some entries .I want to retrieve only Not null data to the detail view. I tried the following

I have a table which stores data with null valued columns for some entries .I want to retrieve only Not null data to the detail view. I tried the following

foreach(string strTableField in (objDataSet.Tables[0].Columns[i])) 
{
    if(objDataSet.Tables[0].Columns[i].Equals(null))
    {
        objDataSet.Tables[0].Columns.R开发者_开发技巧emove(strTableField);
       objDataSet.Tables[0].AcceptChanges();
    }

    i++;
}

but it is giving error .. Pls help me reg this ...


You can use Select method of DataSet class. Like this:

DataRow[] rows = table.Select("field is not null"); 
0

精彩评论

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

关注公众号