L le_toubib Active Member Licensed User Longtime User Sep 19, 2016 #1 hi all i m trying to implement a similar query in JRDC2 : SELECT * FROM patients WHERE ? = ? Click to expand... i.e : dynamic field names since i have too many fields in this table 40+ in php it was possible to directly post the field name , and then parametrize the value , but here in JRDC2 is there a way to do it ?
hi all i m trying to implement a similar query in JRDC2 : SELECT * FROM patients WHERE ? = ? Click to expand... i.e : dynamic field names since i have too many fields in this table 40+ in php it was possible to directly post the field name , and then parametrize the value , but here in JRDC2 is there a way to do it ?
Erel B4X founder Staff member Licensed User Longtime User Sep 20, 2016 #2 Column names cannot be parameterized. You can probably use a stored procedure for that, or a simpler solution is to create a command for each of the fields. Code: Copy sql.select_field1 = SELECT * FROM patients WHERE field1 = ? sql.select_field2 = SELECT * FROM patients WHERE field2 = ? sql.select_field3 = SELECT * FROM patients WHERE field3 = ? sql.select_field4 = SELECT * FROM patients WHERE field4 = ? The command name can be built dynamically in the clients. Upvote 0
Column names cannot be parameterized. You can probably use a stored procedure for that, or a simpler solution is to create a command for each of the fields. Code: Copy sql.select_field1 = SELECT * FROM patients WHERE field1 = ? sql.select_field2 = SELECT * FROM patients WHERE field2 = ? sql.select_field3 = SELECT * FROM patients WHERE field3 = ? sql.select_field4 = SELECT * FROM patients WHERE field4 = ? The command name can be built dynamically in the clients.