Android Question [SOLVED] JRDC2 IN Operator

IlCasti

Active Member
Licensed User
Sorry, pheraps this is a noob question..
How can i use IN operator with JRDC2?

B4X:
Dim cmdList As DBCommand = Db.CreateCommand(Query, Array (X,"763043,763054,755123,759006"))

This return 0 records

This is in properties.config

B4X:
sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?)

Thank you all.
 

OliverA

Expert
Licensed User
Each value in IN needs a ?, so in the example above you would need this in properties.config
B4X:
sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?,?,?,?)
and your DBCommand needs to be set like this
B4X:
Dim cmdList As DBCommand = Db.CreateCommand(Query, Array (X,"763043","763054","755123","759006"))
If your IN parameters are always fixed (like in this case with 4 elements), then the above will work great. If your IN parameters can vary, but only between a few cases, then this link (https://www.b4x.com/android/forum/t...martphone-to-jrdc2-server.111269/#post-693960) may provide a solution. If your IN parameters are completely random in quantity, then you'll have to do some coding and use dynamically created SQL statements.
 
Upvote 0

IlCasti

Active Member
Licensed User
Thank you Oliver
My parameters can vary so i don't know how many will be used in query and they are completely random.

If your IN parameters are completely random in quantity, then you'll have to do some coding and use dynamically created SQL statements.

In RDCHandler? Or where?
Can you tell me how can i do it? Some help shall be appreciated.

Bye
 
Upvote 0
Top