Can't seem to cast SQL result as Boolean to set checkbox.

ikidd

Member
Licensed User
Longtime User
I've been beating my head on this, and I'm sure it's stupid. As per this thread I've been trying to set a checkbox.

attachment.php


is the result. In case you can't make out the code:

B4X:
   Dim Settings As Map
   Settings = dbutils.ExecuteMap(SQL,"Select * from Settings",Null)
   edtUser.Text = Settings.Get("username")
   edtPassword.Text= Settings.Get("password")
   edtMAC.Text=Settings.Get("mac")
   If Settings.Get("bluetooth") = 1 Then
      chkBluetooth.Checked= True 
   Else 
      chkBluetooth.Checked= False
   End If

I've set the type in SQLLite as INTEGER, but it doesn't work as NUMERIC or TEXT, predictably since I don't think types are even necessary when declaring fields in SQLlite.

This is such a silly little issue, but it's obviously driving me up the wall.
 

Attachments

  • BoolSS.png
    BoolSS.png
    17 KB · Views: 509

rboeck

Well-Known Member
Licensed User
Longtime User
Hi,
last week i had some problems with databases; i think, its your problem: for sqlite its only "nice" to make a datatype for the column. In reality, it is only relevant, which datatype you store! I hade sql queries, where the sort order of an double field was in two segments: the first block was stored as strings, then second block were the correct saved values as double. In other databases this would be impossible, in Sqlite it's not a bug, it's a feature!;)
Greetings,
Reinhard
 
Upvote 0
Top