Lesson 3 SQL Search problem

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
jpyck
Posts: 8
Joined: Tue Mar 11, 2014 5:12 pm

Lesson 3 SQL Search problem

Post by jpyck » Sun Mar 30, 2014 12:12 am

SQL Newbie question:

When implementing lesson 3 database search on (Win 8) I get errors:
1)SQLite: search string is "go" with sample database
Code is:
put "SELECT firstname,lastname,contact_id FROM contacts" into tSQLQuery
put "WHERE firstname LIKE '%" & tSearchText & "%' OR lastname LIKE '%" & tSearchText & "%'" after tSQLQuery
ERROR is:"revdberr,Database Error: near "LIKE": syntax error"

2)My SQL: search string is "go" with sample database
Code is same as above
ERROR is: revdberr,You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%go%' OR lastname LIKE '%go%'' at line 1

3) Search with the Web MySQL code works fine.
Code:
put url ("http://techsupport.on-rev.com/cloudtest ... lc?search=" & tSearchText) into tContacts

Any help is appreciated.
Jack

SparkOut
Posts: 1988
Joined: Sun Sep 23, 2007 4:58 pm

Re: Lesson 3 SQL Search problem

Post by SparkOut » Sun Mar 30, 2014 1:01 am

Try putting the tSQLquery contents and see how it reads.
It seems to me that where you construct the query by appending the where clause, you haven't left a space between them so your query will have an unparsable word 'contactsWHERE' in the middle?

jpyck
Posts: 8
Joined: Tue Mar 11, 2014 5:12 pm

Re: Lesson 3 SQL Search problem

Post by jpyck » Sun Mar 30, 2014 8:45 pm

Thanks Sparkout, once again your keen eye saved my day. I am new to SQL and will have quite a learning curve...
Jack

Post Reply

Return to “idea2app and Coding School”