ps.bind multiple values

I am a newbie and struggling to work out how to prepare a statement using ps.bind to query a SQLite DB. The issue I am grappling with is how to bind multiple values for a single db field and then execute ps.bind.

In this instance the user selects up to 12 radio buttons that represent month and I would like the db sql to return all the matching records for the multiple selections.

I can do this for a single month using a single ps.bind but not for multiple month/values.

Any thoughts?

You will need 12 checkboxes rather than radio buttons. Your database will need an INTEGER or BOOEAN (same in SQLite, 0 or 1) field to hold the monthly values. Then as you build the SELECT … FROM … WHERE command, if a month is checked on, add the String "AND isJanuary = 1 "

CheckBoxes because RadioBoxes are meant for single selection scenarios.
As long as you have full control over your SQL Querry (no user text/string input involved) a prepared statement is not necessary (no SQL injection possible).

Assuming that month is just one column in your SQL table, do as David said, just create your querry as usual “SELECT ... FROM ... WHERE month=[STRING representation of CheckBox_0.Value] OR month=[STRING representation of CheckBox_1.Value] OR month=[STRING representation of CheckBox_2.Value]...

But if each month has it’s own column and those columms are BOOLEANs (or INTEGERs), a prepared statement could make things simpler. Because you could do: “SELECT ... FROM ... WHERE month1=? OR month2=? OR ...

ps.Bind(0, CheckBox_0.Value, SQLPreparedStatement.SQLite_Boolean) ps.Bind(1, CheckBox_1.Value, SQLPreparedStatement.SQLite_Boolean) ...

(Code taken from my mind)

[quote=450707:@Sascha S]CheckBoxes because RadioBoxes are meant for single selection scenarios.
As long as you have full control over your SQL Querry (no user text/string input involved) a prepared statement is not necessary (no SQL injection possible).

Assuming that month is just one column in your SQL table, do as David said, just create your querry as usual “SELECT ... FROM ... WHERE month=[STRING representation of CheckBox_0.Value] OR month=[STRING representation of CheckBox_1.Value] OR month=[STRING representation of CheckBox_2.Value]...

But if each month has it’s own column and those columms are BOOLEANs (or INTEGERs), a prepared statement could make things simpler. Because you could do: “SELECT ... FROM ... WHERE month1=? OR month2=? OR ...

ps.Bind(0, CheckBox_0.Value, SQLPreparedStatement.SQLite_Boolean) ps.Bind(1, CheckBox_1.Value, SQLPreparedStatement.SQLite_Boolean) ...

(Code taken from my mind)[/quote]

I originally chose radio buttons as they have only 2 states whereas checkboxes have 3. How would I use checkboxes and limit it to 2 states?

Checkboxes only have two states from a user point of view. The only way to get the middle state is if you set it in code.

Great. Thanks

In order to save on real estate I would like to use a SelectablePopupMenu but cannot see how I would enable it to accept multiple selection. Is this possible? If not what would would be the best option?