Post
by AxWald » Mon Jun 30, 2014 12:54 pm
Hi,
may be off topic, but I have found it a good way to create my SQL statements in a reliable environment (SQLite Manager, MS-Access, HeidiSQL, ...) at first, test that they give the proper results with random arguments, and only then copy the query over into LC.
I'm using a text editor (EditPad) for this, in the middle. This helps me to replace, for instance, the variable in (WHERE MyNum = '1' AND ....). I select the 1 and insert a prefab value: (" & MyVarName & ") . Replace MyVarName with the actual variable, and you're done ;-)
Even adding (the put "[MySelection]" into MySQLStr) can be added semi-automagically, as well as proper quotes at the beginning, and proper (" & \ ) at the end of the lines ...
This saves a lot of work, and saves me from major debugging in case I'd have misspelled one of the many brackets and quotes in an a bit more challenging SQL statement!
Edit: Just see, it's a chaos of quote chars here ... So I omitted any quotes of this text, only leaving the ones used in statements - using brackets instead ...
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!