Difference between revisions of "MySQL and PowerShell"

Jump to navigation Jump to search
m
→‎Test for NULL: Added additional error example
m (→‎Reader Query: Corrected error in example)
m (→‎Test for NULL: Added additional error example)
Line 145: Line 145:


= Test for NULL =
= Test for NULL =
In order to be able to test for a NULL value in a set of results from a query, you need to compare against a specific DB NULL value.  Otherwise you'll get an error similar to...
In order to be able to test for a NULL value in a set of results from a query, you need to compare against a specific DB NULL value.  Otherwise you can get errors similar to...


<code> Error: "Cannot convert the "0" value of type "System.Int32" to type "System.DBNull" </code>
Error: "Cannot convert the "0" value of type "System.Int32" to type "System.DBNull"  
Method invocation failed because [System.DBNull] doesn't contain a method named 'xxx'.


So to correctly test, use the following...
So to correctly test, use the following...

Navigation menu