Trying to take the advice of the wise sages on this forum, I am not going to continue to use the NewRecord class and instead use the SQL INSERT INTO… Command.
But I’m have trouble with dates and booleans.
TransactionDate is a table field defined as DATE. TransDate is a DATE variable.
sSQL = "SQL INSERT INTO TestTable (TransactionDate, Posted) Value (" + TransDate + ", " + bPosted + ")"
How do I specify a Date field and Boolean field in the values list?
sSQL = "SQL INSERT INTO TestTable (TransactionDate, Posted) Value ('" + TransDate.SQLDATE + "',' " + Str(bPosted) + "')"
This should work… Xojo function
should return a valid date value and boolean
SQLite uses 0/1
if you use SQL directly to extract data, treat it as STRING results
NOTE : the example above could be prone to SQL Injection, use PREPARED statements in production code
Use preparedstatements. It wiil secure against sql injection and make your code more readable.
Without prepared statements you should set a boolean as 0 of 1 in sqlite. Date is a string from Date.SQLDateTime or so.