![]() |
Null<>Null?
hey
maybe im being stupid here but its been awhile since i did a database frontend. Im using vb6 and mysql db. One of my fields in database can be null and is set to be as default, sometimes i need to check this so i have a simple statement if rs!date_in = Null then ... However this appears to never be true during runtime, a debug shows that rs!date_in is in fact null but vb beleives it still doesnt warrant executing the if statement lol. Anyways what im asking is vb's null different to mysql? and how would you get around this problem considering the field has to able to be null and i have to know when it is? p.s. i tried setting a default value of 0000-00-00 00:00:00 (datetime standard) however the ql still returns this as null! >.< Thanks in advance |
This is not definitive help, but I've had difficulties reconciling NULL values from time to time. If you try to store NULL into a MySQL column that doesn't accept NULL, you will store a zero or "". MySQL has an IFNULL (a, b) and an ISNULL function which you might use to constrain the value returned to your code. VB has IsNull (). You should probably use these kinds of tests as NULL (as well as NaN) is treated differently by many languages. Sorry I can't give you any truly solid solution. Incidentally, I think the date field being zero vs NULL was changed at some version level. Crap like that always helps, right?
|
Quote:
the IsNull function sorted my problem though thanks :) |
Glad I could give you some investigative paths, because there's no widespread approach. In some languages, if (null == null) will return false (the theory being that null isn't equal to anything), and that kinda sucks.
|
| All times are GMT -5. The time now is 7:40 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC