There are some missing spaces i think:
string stCmdString = "SELECT " + stFieldNames + " FROM " + stTableName
+ " WHERE " + stLikeFieldName + " LIKE '%'||" +
liststLikeFieldValue[0] + "||'%'";
Am 26.01.17 um 15:04 schrieb Clyde Eisenbeis:
I tried replacing this:
string stCmdString = "SELECT" + stFieldNames + "FROM " + stTableName
+ " WHERE " + stLikeFieldName + " LIKE '%" + liststLikeFieldValue[0] +
"%'";
with this:
string stCmdString = "SELECT" + stFieldNames + "FROM " + stTableName
+ " WHERE " + stLikeFieldName + " LIKE '%'||" +
liststLikeFieldValue[0] + "||'%'";
Does not work.
On Wed, Jan 25, 2017 at 11:53 AM, Richard Hipp <d...@sqlite.org> wrote:
On 1/25/17, Warren Young <war...@etr-usa.com> wrote:
stCmdString += " AND ‘%?1%’ LIKE ‘%?2%’”;
Then use the sqlite3_bind_*() calls to insert parameters 1 and 2 into the
string.
Not quite. You cannot have parameters embedded in the middle of
strings. The whole string is replaced by a parameter.
stCmdString += " AND fstInfo LIKE ?1 AND fstInfo LIKE ?2"
Then the application has to prepend and append the "%" on the strings
before binding. Or, if your application does not want to do that:
stCmdString += " AND fstInfo LIKE ('%' || ?1 || '%') AND fstInfo
LIKE ('%' || ?2 || '%')"
Then you can bind the search patterns directly to ?1 and ?2. (Aside:
|| is the string concatenation operator in SQL.)
--
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users