Click here to Skip to main content
15,888,600 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I want to check datacolumn type is boolean i want to check eitherr any rows having false or not
can u guide me or send snipets


C#
bool flag = false;

           DataRow[] rows = dt.Select("Discontinue="+flag);
            if (rows != null)
            {
              ///
////

            }
Posted
Comments
samit kaneriya 25-Feb-14 8:03am    
C# use bool and SQL use bit so if you use bit then true/false now for filter in sql query you can use 1/0 in your query

1 solution

C#
bool flag = false;

DataRow[] rows = dt.Select("Discontinue="+flag);
if (rows != null)
{
  for(int i=0; i < rows.Length; i++)
  {
    for(int j=0; j < rows[i].ItemArray.Length; j++)
    {
      if(rows[i].Item[j] is bool && !((bool)rows[i].Item[j]))
        flag = true;
    }
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900