I IlCasti Active Member Licensed User Longtime User Dec 11, 2019 #1 Sorry, pheraps this is a noob question.. How can i use IN operator with JRDC2? Code: Dim cmdList As DBCommand = Db.CreateCommand(Query, Array (X,"763043,763054,755123,759006")) This return 0 records This is in properties.config Code: sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?) Thank you all.
Sorry, pheraps this is a noob question.. How can i use IN operator with JRDC2? Code: Dim cmdList As DBCommand = Db.CreateCommand(Query, Array (X,"763043,763054,755123,759006")) This return 0 records This is in properties.config Code: sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?) Thank you all.
OliverA Expert Licensed User Longtime User Dec 11, 2019 #2 Each value in IN needs a ?, so in the example above you would need this in properties.config Code: sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?,?,?,?) and your DBCommand needs to be set like this Code: 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
Each value in IN needs a ?, so in the example above you would need this in properties.config Code: sql.xxx=SELECT Cat, prod, x FROM supprod where id = ? and idprodotto in(?,?,?,?) and your DBCommand needs to be set like this Code: 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.
I IlCasti Active Member Licensed User Longtime User Dec 11, 2019 #3 Thank you Oliver My parameters can vary so i don't know how many will be used in query and they are completely random. OliverA said: If your IN parameters are completely random in quantity, then you'll have to do some coding and use dynamically created SQL statements. Click to expand... In RDCHandler? Or where? Can you tell me how can i do it? Some help shall be appreciated. Bye Upvote 0
Thank you Oliver My parameters can vary so i don't know how many will be used in query and they are completely random. OliverA said: If your IN parameters are completely random in quantity, then you'll have to do some coding and use dynamically created SQL statements. Click to expand... In RDCHandler? Or where? Can you tell me how can i do it? Some help shall be appreciated. Bye
I IlCasti Active Member Licensed User Longtime User Dec 11, 2019 #4 Thank you Oliver I read this thread linked into your first linked address OliverA said: https://www.b4x.com/android/forum/t...martphone-to-jrdc2-server.111269/#post-693960 Click to expand... and i solved my situation use a query without params after replacing them in command rdc connector and doing some other coding change. I never had read jrdc code before. Thank you again. Bye! Upvote 0
Thank you Oliver I read this thread linked into your first linked address OliverA said: https://www.b4x.com/android/forum/t...martphone-to-jrdc2-server.111269/#post-693960 Click to expand... and i solved my situation use a query without params after replacing them in command rdc connector and doing some other coding change. I never had read jrdc code before. Thank you again. Bye!