P peggjones Active Member Licensed User Longtime User May 11, 2015 #1 How can I ignore a null value? When I execute code like the following Log(Cursor.GetString("number")) If number contains a null I would like to just ignore it rather than have the program fall over. Is there any an easy way to do this? Many Thanks
How can I ignore a null value? When I execute code like the following Log(Cursor.GetString("number")) If number contains a null I would like to just ignore it rather than have the program fall over. Is there any an easy way to do this? Many Thanks
Peter Simpson Expert Licensed User Longtime User May 11, 2015 #2 Have you tried placing your code within the Try statement? Personally I would try the code below. If that does not work then just change your SQL query to replace Null with a 0. Just a quick guess as I'm typing using my phone. Code: Copy Try Number = Cursor.GetString("number") Catch Log(LastException.Message) Return End Try Last edited: May 11, 2015 Upvote 0
Have you tried placing your code within the Try statement? Personally I would try the code below. If that does not work then just change your SQL query to replace Null with a 0. Just a quick guess as I'm typing using my phone. Code: Copy Try Number = Cursor.GetString("number") Catch Log(LastException.Message) Return End Try
eurojam Well-Known Member Licensed User Longtime User May 11, 2015 #3 Code: Copy If Cursor1.GetString("number") <> Null Then myNumber = Cursor1.GetString("number") Else myNumber= "NULL" 'or whatever End If you can also use Cursor1.GetDouble to retrieve numbers Upvote 0
Code: Copy If Cursor1.GetString("number") <> Null Then myNumber = Cursor1.GetString("number") Else myNumber= "NULL" 'or whatever End If you can also use Cursor1.GetDouble to retrieve numbers
incendio Well-Known Member Licensed User Longtime User May 11, 2015 #4 Here is my version : Code: Copy Lbl.Text = GetString(1) If(Lbl.Text = "null") Then Lbl.Text = "" Upvote 0