RowSet

Hi everyone,
I am still a bit confused on how to make rowsets with different criterias:
I have a SQLite database with a table called contracts. In that table, I have a few fields and two of them are called name and active.
Name has the customer name and Active has either an “x” (no quotes) or blank. I want to populate a listbox with those that only have an x as active. I wrote the following code but I check an error when it goes to open the listbox.

var rs2 as RowSet
Var sql as string
Var Act as string
Act = “x”
sql = "select * from Contracts ORDER by Name Where Active = ? "
rs2 = app.db.SelectSQL(sql,Act)

Thank You

The order the parts of the statement matter. In this case, the WHERE clause must come before ORDER BY.

1 Like

Thank You Kem

Might help you to test SQL statements. On the left side, you have to paste SQL code to mimic your scheme, so basically how your table looks like, and on the right-hand side, you can then test your SQL.

Edit: corrected “your shame” into “your scheme” :wink:

1 Like