LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read the BIT value from SQL Server in CVI

Solved!
Go to solution

Hello,

 

I am trying to get a bit value (ture/false) from SQL Server 2005 in CVI (with SQL toolkit). I am using the DBBindInt, but throughout the return value is -1.

 

How can I get the real value from SQL?

 

Thanks for your help

 

ReGion

0 Kudos
Message 1 of 4
(3,758 Views)
Solution
Accepted by topic author ReGion

Do you mean that you never receive a FALSE value, ie 0? Or did you expect a TRUE value to be exactly 1? It is very common for TRUE to be represented as -1; if this worries you just mask off all bits of the returned value except for bit 0 - this will then give your 0/1 alternative.

 

JR

Message Edited by jr_2005 on 11-13-2008 04:19 PM
0 Kudos
Message 2 of 4
(3,747 Views)

Thank you for your help, but you miss my mind.

 

I mean that the value="true" but the DBBindColInt return value is "-1", and the value="false" but the DBBindColInt return value is "-1" too.

 

The Qustion is : Which function can get the bit data type?

 

I used DBColType to get Col's data type, and the return value is "11", that's DB_BOOLEAN data type.

 

Thanks!

 

ReGion

帖子被ReGion在 11-13-2008 07:20 PM
时编辑过了
0 Kudos
Message 3 of 4
(3,732 Views)

I used DBBindColInt function, the false return -1 and the true return 0. It's working.

 

Thank you for your help

0 Kudos
Message 4 of 4
(3,698 Views)