Android Question Get field type from resultset

Mostez

Well-Known Member
Licensed User
I use JdbcResultSet to read data from SQL database, I'm making a search dialog box to filter data, i want to add quotes to search-criteria according to its type like

B4X:
if field.type = text then
      strSearch = ("'" & value & "'" )
else
      strSearch = (value)
end if

I tried IsNumber function, but when searching for phone number(text field) it returns true, so i can not add quotes in this case!!
I think about adding check box to let user select if this Value is real number like unit-price, or if it is text, like phone-number!

any ideas how solve this problem?
 

Mahares

Expert
Licensed User
i tried to put the quotes in both cases, i think it works ,
If you want to preserve the double quotes as part of the string, always use Smart Strings. Here it is:
B4X:
Dim value As String = "Mostez"
    Dim strSearch As String= $""${value}""$
    Log(strSearch)   'displays: "Mostez"
I hope this is in line with what you are trying to achieve. If not, ditch.
 
Upvote 0
Top