05-11-2012 02:42 AM
I read an integer from a database which was returned as a variant.
The value is 25, but if the VI converts it to I32, the returned value is 0.
Why does it happen? How can I fix it?
Solved! Go to Solution.
05-11-2012 02:56 AM
Hm, i would say that you have an issue with the numeric value in the variant, not with the cast.
Attached you find a VI combining different numeric data types for casting but i always received the expected value.
Are you sure that "Variant To Data" does not return an error? Have you already probed the variant to check if it contains the expected values?
Norbert
05-11-2012 03:04 AM
here's a snippet that return the type of data contained in a variant.
hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 03:05 AM
@Norbert_B wrote:
Hm, i would say that you have an issue with the numeric value in the variant, not with the cast.
Attached you find a VI combining different numeric data types for casting but i always received the expected value.
Are you sure that "Variant To Data" does not return an error? Have you already probed the variant to check if it contains the expected values?
Norbert
I see
Error -2147467261 : ConvertDBDataToNmtData[V.01].vi->Impl_ReadNMTFromAccessDB[V.02].vi "Wrong Pointer"
LabVIEW: (Hex 0x80004003) Invalid Pointer.
This error happens when "Variant To Data" tries to convert a variant matching DB NULL value to another type.
How do I check a NULL value?
05-11-2012 03:11 AM
What is the version of LV you are using?
05-11-2012 03:13 AM
2009 SP1
05-11-2012 03:42 AM
Can you look into MAX and find out which version of the Database Connectivity Toolkit you have?
05-11-2012 04:48 AM
@iCat wrote:
The value is 25, but if the VI converts it to I32, the returned value is 0.
Try to use Database Variant To Data instead of Variant To Data:
05-11-2012 04:49 AM
@TiTou wrote:
here's a snippet that return the type of data contained in a variant.
hope this helps
this doesn't help?
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 11:07 PM