MrKim Well-Known Member Licensed User Longtime User May 11, 2019 #1 I am trying to figure out how to get consistent results from Null. jtds database driver returns something "sort of like" null - but different. I just need to consistently test for null. See results below: ActiveEmp.PassWord has been initialized: Set to B4A Null: Set to Null returned by database/driver:
I am trying to figure out how to get consistent results from Null. jtds database driver returns something "sort of like" null - but different. I just need to consistently test for null. See results below: ActiveEmp.PassWord has been initialized: Set to B4A Null: Set to Null returned by database/driver:
R RB Smissaert Well-Known Member Licensed User Longtime User May 11, 2019 #2 MrKim said: I am trying to figure out how to get consistent results from Null. jtds database driver returns something "sort of like" null - but different. I just need to consistently test for null. See results below: ActiveEmp.PassWord has been initialized: View attachment 80291 Set to B4A Null: View attachment 80292 Set to Null returned by database/driver: View attachment 80293 Click to expand... Can you show the SQL that gets the data into Crsr? Are you aware of the coalesce function? RBS Upvote 0
MrKim said: I am trying to figure out how to get consistent results from Null. jtds database driver returns something "sort of like" null - but different. I just need to consistently test for null. See results below: ActiveEmp.PassWord has been initialized: View attachment 80291 Set to B4A Null: View attachment 80292 Set to Null returned by database/driver: View attachment 80293 Click to expand... Can you show the SQL that gets the data into Crsr? Are you aware of the coalesce function? RBS
M Mahares Expert Licensed User Longtime User May 11, 2019 #3 You can probably use the ifnull function: Code: Copy ActiveEmp.Password =Starter.SQL1.ExecQuerySingleResult2("SELECT ifnull(Emp_BadgeNum,'') FROM mytable WHERE user LIKE ?", _ Array As String("%MrKim%")) 'note 2 single quotes after Emp_BadgeNum, Upvote 0
You can probably use the ifnull function: Code: Copy ActiveEmp.Password =Starter.SQL1.ExecQuerySingleResult2("SELECT ifnull(Emp_BadgeNum,'') FROM mytable WHERE user LIKE ?", _ Array As String("%MrKim%")) 'note 2 single quotes after Emp_BadgeNum,
MrKim Well-Known Member Licensed User Longtime User May 13, 2019 #4 RB Smissaert said: Can you show the SQL that gets the data into Crsr? Are you aware of the coalesce function? RBS Click to expand... Good Idea. Out of habit I try to keep server side processing to a minimum and do busy work like this on the WS/tablet where there is plenty of spare CPU power but in this case probably not. Mahares said: You can probably use the ifnull function: Code: Copy ActiveEmp.Password =Starter.SQL1.ExecQuerySingleResult2("SELECT ifnull(Emp_BadgeNum,'') FROM mytable WHERE user LIKE ?", _ Array As String("%MrKim%")) 'note 2 single quotes after Emp_BadgeNum, Click to expand... in TSQL it is IsNull, not IfNull but as with Coalesce, also a good idea, thanks. Last edited: May 13, 2019 Upvote 0
RB Smissaert said: Can you show the SQL that gets the data into Crsr? Are you aware of the coalesce function? RBS Click to expand... Good Idea. Out of habit I try to keep server side processing to a minimum and do busy work like this on the WS/tablet where there is plenty of spare CPU power but in this case probably not. Mahares said: You can probably use the ifnull function: Code: Copy ActiveEmp.Password =Starter.SQL1.ExecQuerySingleResult2("SELECT ifnull(Emp_BadgeNum,'') FROM mytable WHERE user LIKE ?", _ Array As String("%MrKim%")) 'note 2 single quotes after Emp_BadgeNum, Click to expand... in TSQL it is IsNull, not IfNull but as with Coalesce, also a good idea, thanks.