New topic: MySql recordset field passed as parameter to a fct + variant
<http://forums.realsoftware.com/viewtopic.php?t=47673> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message eiffel Post subject: MySql recordset field passed as parameter to a fct + variantPosted: Mon Apr 22, 2013 4:09 pm Joined: Sun Feb 24, 2013 5:11 pm Posts: 2 Hello all, First newbie question to the forum. I have a MYSQL recordset field in function A. Function A is calling function B and provide the previous MYSQL recordset field value to function B. Function B gets the parameter as a variant type variable. I have a problem when the recordset field in function A is null (integer variable type). In function B the input variant parameter is equal to 0 as I would expect to get it as nil like parameter in the calling function! What should I get in order to get a null / nil value in function B? Thanks for your help. Fred Top timhare Post subject: Re: MySql recordset field passed as parameter to a fct + varPosted: Mon Apr 22, 2013 5:40 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 12262 Location: Portland, OR USA Use Variant.IsNull to determine if the database field contained a null. Top eiffel Post subject: Re: MySql recordset field passed as parameter to a fct + varPosted: Tue Apr 23, 2013 1:15 pm Joined: Sun Feb 24, 2013 5:11 pm Posts: 2 I have tried in function B but it does not work because the value arrives with 0 inside the function. I was using the syntax rs("fieldA").integervalue when I was calling the function. I then made a tried with the following syntax rs("fieldA").value and in that case I got the null if the fied rs("fieldA").value is null. Is there someone that can explain me why? Thanks for your help. F. Top timhare Post subject: Re: MySql recordset field passed as parameter to a fct + varPosted: Tue Apr 23, 2013 5:59 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 12262 Location: Portland, OR USA When you use IntegerValue, it must return an integer. There is no way it can return null. The nearest equivalent is 0. Value returns a variant, which is the only type that can represent a null. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
