Hello,

Iam trying to do the following-

if(myColumn.DataType==typeof(bool))
{
}

I get the error "Operator == cannot be applied to operands type and object
and bool."

Is there a workaround?

Thanks.
jay

Re: Check to see DataColumn DataType is Boolean? by Sericinus

Sericinus
Wed May 03 15:59:31 CDT 2006

Jay Balapa wrote:
> Hello,
>
> Iam trying to do the following-
>
> if(myColumn.DataType==typeof(bool))
> {
> }
>
> I get the error "Operator == cannot be applied to operands type and object
> and bool."
>
> Is there a workaround?

Try Type.GetType("System.Boolean") instead of typeof(bool).

Re: Check to see DataColumn DataType is Boolean? by Jay

Jay
Wed May 03 16:12:26 CDT 2006

Hi Hunter,

Error states that I cannot use "==" operator period when comparing Boolean.

I have tried what you suggested and it does not work.

jay



"Sericinus hunter" <serhunt@flash.net> wrote in message
news:TQ86g.779$zR3.413@newssvr33.news.prodigy.com...
> Jay Balapa wrote:
>> Hello,
>>
>> Iam trying to do the following-
>>
>> if(myColumn.DataType==typeof(bool))
>> {
>> }
>>
>> I get the error "Operator == cannot be applied to operands type and
>> object and bool."
>>
>> Is there a workaround?
>
> Try Type.GetType("System.Boolean") instead of typeof(bool).



Re: Check to see DataColumn DataType is Boolean? by Sericinus

Sericinus
Wed May 03 16:24:19 CDT 2006

Jay Balapa wrote:
> Hi Hunter,
>
> Error states that I cannot use "==" operator period when comparing Boolean.
>
> I have tried what you suggested and it does not work.
>
> jay

Strange. Works for me with .Net 1.1

> "Sericinus hunter" <serhunt@flash.net> wrote in message
> news:TQ86g.779$zR3.413@newssvr33.news.prodigy.com...
>> Jay Balapa wrote:
>>> Hello,
>>>
>>> Iam trying to do the following-
>>>
>>> if(myColumn.DataType==typeof(bool))
>>> {
>>> }
>>>
>>> I get the error "Operator == cannot be applied to operands type and
>>> object and bool."
>>>
>>> Is there a workaround?
>> Try Type.GetType("System.Boolean") instead of typeof(bool).
>
>

Re: Check to see DataColumn DataType is Boolean? by Jay

Jay
Wed May 03 16:40:03 CDT 2006

Iam using 2.0.


"Sericinus hunter" <serhunt@flash.net> wrote in message
news:7c96g.782$zR3.530@newssvr33.news.prodigy.com...
> Jay Balapa wrote:
>> Hi Hunter,
>>
>> Error states that I cannot use "==" operator period when comparing
>> Boolean.
>>
>> I have tried what you suggested and it does not work.
>>
>> jay
>
> Strange. Works for me with .Net 1.1
>
>> "Sericinus hunter" <serhunt@flash.net> wrote in message
>> news:TQ86g.779$zR3.413@newssvr33.news.prodigy.com...
>>> Jay Balapa wrote:
>>>> Hello,
>>>>
>>>> Iam trying to do the following-
>>>>
>>>> if(myColumn.DataType==typeof(bool))
>>>> {
>>>> }
>>>>
>>>> I get the error "Operator == cannot be applied to operands type and
>>>> object and bool."
>>>>
>>>> Is there a workaround?
>>> Try Type.GetType("System.Boolean") instead of typeof(bool).
>>


Re: Check to see DataColumn DataType is Boolean? by MSDN

MSDN
Wed May 03 17:37:09 CDT 2006

This works, .NET - FW2.0

DataColumn myColumn = new
DataColumn("name",System.Type.GetType("System.Boolean"));

if (myColumn.DataType == typeof(bool))

{

if (myColumn.DataType == typeof(Boolean))

{

xxx = "okay";

}

}



"Jay Balapa" <jbalapa@hotmail.com> wrote in message
news:OdPENEvbGHA.1208@TK2MSFTNGP02.phx.gbl...
> Hello,
>
> Iam trying to do the following-
>
> if(myColumn.DataType==typeof(bool))
> {
> }
>
> I get the error "Operator == cannot be applied to operands type and object
> and bool."
>
> Is there a workaround?
>
> Thanks.
> jay
>
>
>
>



Re: Check to see DataColumn DataType is Boolean? by Miha

Miha
Thu May 04 03:02:08 CDT 2006

Hi Jay,

That code should work.
What is the myColumn type exactly?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Jay Balapa" <jbalapa@hotmail.com> wrote in message
news:OdPENEvbGHA.1208@TK2MSFTNGP02.phx.gbl...
> Hello,
>
> Iam trying to do the following-
>
> if(myColumn.DataType==typeof(bool))
> {
> }
>
> I get the error "Operator == cannot be applied to operands type and object
> and bool."
>
> Is there a workaround?
>
> Thanks.
> jay
>
>
>
>



Re: Check to see DataColumn DataType is Boolean? by Jay

Jay
Thu May 04 09:29:11 CDT 2006

Hi Miha,

Thanks for replying.

myColumn is just an iterator for a row.

foreach (DataColumn myColumn from myTable.Columns)

Thanks.
jay

"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:ugSGME1bGHA.4108@TK2MSFTNGP03.phx.gbl...
> Hi Jay,
>
> That code should work.
> What is the myColumn type exactly?
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Jay Balapa" <jbalapa@hotmail.com> wrote in message
> news:OdPENEvbGHA.1208@TK2MSFTNGP02.phx.gbl...
>> Hello,
>>
>> Iam trying to do the following-
>>
>> if(myColumn.DataType==typeof(bool))
>> {
>> }
>>
>> I get the error "Operator == cannot be applied to operands type and
>> object and bool."
>>
>> Is there a workaround?
>>
>> Thanks.
>> jay
>>
>>
>>
>>
>
>



Re: Check to see DataColumn DataType is Boolean? by Miha

Miha
Thu May 04 11:52:47 CDT 2006

Can you create a simple sample that reproduces the problem?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Jay Balapa" <jbalapa@hotmail.com> wrote in message
news:e29qFd4bGHA.3348@TK2MSFTNGP03.phx.gbl...
> Hi Miha,
>
> Thanks for replying.
>
> myColumn is just an iterator for a row.
>
> foreach (DataColumn myColumn from myTable.Columns)
>
> Thanks.
> jay
>
> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
> news:ugSGME1bGHA.4108@TK2MSFTNGP03.phx.gbl...
>> Hi Jay,
>>
>> That code should work.
>> What is the myColumn type exactly?
>>
>> --
>> Miha Markic [MVP C#]
>> RightHand .NET consulting & development www.rthand.com
>> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>>
>> "Jay Balapa" <jbalapa@hotmail.com> wrote in message
>> news:OdPENEvbGHA.1208@TK2MSFTNGP02.phx.gbl...
>>> Hello,
>>>
>>> Iam trying to do the following-
>>>
>>> if(myColumn.DataType==typeof(bool))
>>> {
>>> }
>>>
>>> I get the error "Operator == cannot be applied to operands type and
>>> object and bool."
>>>
>>> Is there a workaround?
>>>
>>> Thanks.
>>> jay
>>>
>>>
>>>
>>>
>>
>>
>
>



Re: Check to see DataColumn DataType is Boolean? by Cor

Cor
Thu May 04 12:37:06 CDT 2006

Jay,

Can you show the code as you did that,
This should in my opinion be the same in 1.x as in 2.0


Cor

"Jay Balapa" <jbalapa@hotmail.com> schreef in bericht
news:uOpWKpvbGHA.3908@TK2MSFTNGP02.phx.gbl...
> Iam using 2.0.
>
>
> "Sericinus hunter" <serhunt@flash.net> wrote in message
> news:7c96g.782$zR3.530@newssvr33.news.prodigy.com...
>> Jay Balapa wrote:
>>> Hi Hunter,
>>>
>>> Error states that I cannot use "==" operator period when comparing
>>> Boolean.
>>>
>>> I have tried what you suggested and it does not work.
>>>
>>> jay
>>
>> Strange. Works for me with .Net 1.1
>>
>>> "Sericinus hunter" <serhunt@flash.net> wrote in message
>>> news:TQ86g.779$zR3.413@newssvr33.news.prodigy.com...
>>>> Jay Balapa wrote:
>>>>> Hello,
>>>>>
>>>>> Iam trying to do the following-
>>>>>
>>>>> if(myColumn.DataType==typeof(bool))
>>>>> {
>>>>> }
>>>>>
>>>>> I get the error "Operator == cannot be applied to operands type and
>>>>> object and bool."
>>>>>
>>>>> Is there a workaround?
>>>> Try Type.GetType("System.Boolean") instead of typeof(bool).
>>>
>