Author |
Topic |
leatherlips
Senior Member
USA
1838 Posts |
Posted - 16 May 2008 : 22:33:17
|
I installed the search log mod and now get the following error whenever I use a search that includes a word with an apostrohpe in it (the word in red is my search term):
Syntax error (missing operator) in query expression 'SLK_KEYWORD='can't''.
/forum/inc_searchlog.asp, line 48
Here is line 48 (in green) and the surrounding lines in inc_searchlog.asp:
Sub AddKeywordsToDB() Dim keywords, keycnt, rs_keyword, tempID keywords = split(Request.Form("Search"), " ") keycnt = ubound(keywords) for i = 0 to keycnt strsql = "SELECT SLK_ID FROM " & strTablePrefix & "SEARCHLOG_KEYWORDS WHERE SLK_KEYWORD='" & keywords(i) & "'" Set rs_keyword = my_conn.execute(strsql) If rs_keyword.EOF Or rs_keyword.BOF Then rs_keyword.Close Set rs_keyword = nothing strsql = "INSERT INTO " & strTablePrefix & "SEARCHLOG_KEYWORDS (SLK_KEYWORD, SLK_COUNT) VALUES ('" & Left(keywords(i),255) & "', 1)" my_conn.Execute (strsql),,adCmdText + adExecuteNoRecords Else
What is the way to fix this?< |
Mangione Magic Forum - The Music of Chuck Mangione
My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD |
|
phy1729
Average Member
USA
589 Posts |
Posted - 16 May 2008 : 22:52:12
|
It works here. I think your missing a ckstr somewhere.< |
|
|
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 17 May 2008 : 03:47:51
|
Like Leatherlips, I get the same error Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'SLK_KEYWORD='can't''. /forum/inc_searchlog.asp, line 57 < |
|
|
phy1729
Average Member
USA
589 Posts |
Posted - 17 May 2008 : 11:01:21
|
Try:
strsql = "SELECT SLK_ID FROM " & strTablePrefix & "SEARCHLOG_KEYWORDS WHERE SLK_KEYWORD='" & chkString(keywords(i),"SQLString") & "'"
Set rs_keyword = my_conn.execute(strsql)
< |
|
|
leatherlips
Senior Member
USA
1838 Posts |
|
phy1729
Average Member
USA
589 Posts |
Posted - 17 May 2008 : 11:28:23
|
What is the error? You'll need to change this line also
strsql = "INSERT INTO " & strTablePrefix & "SEARCHLOG_KEYWORDS (SLK_KEYWORD, SLK_COUNT) VALUES ('" & Left(chkString(keywords(i),"SQLString"),255) & "', 1)"
< |
Edited by - phy1729 on 17 May 2008 11:32:29 |
|
|
phy1729
Average Member
USA
589 Posts |
Posted - 17 May 2008 : 11:32:51
|
In AddQueriesToDB you will need to change
myquery = chkString(Request.Form("Search"),"SQLString")
< |
|
|
leatherlips
Senior Member
USA
1838 Posts |
|
leatherlips
Senior Member
USA
1838 Posts |
|
phy1729
Average Member
USA
589 Posts |
Posted - 17 May 2008 : 11:54:16
|
Add a Response.Write strsql before each my_conn.execute(strsql) so we can see what the queries are. Are you sure there are results for can't?< |
|
|
leatherlips
Senior Member
USA
1838 Posts |
|
leatherlips
Senior Member
USA
1838 Posts |
|
phy1729
Average Member
USA
589 Posts |
Posted - 17 May 2008 : 13:32:05
|
quote: Originally posted by leatherlips
There should be results for "can't". It's in a song title.
I added the Response.Write strsql as you said but I still do not get any results for words with apostrophes. Unless I didn't do it correctly.
I want to have a look at what the sql was. So before each SomeVar=my_conn.execute(strsql) if you add Response.Write strsql it will output the sql query.
The can't can't we do this all night problem is interesting and some light may be shed on it by seeing the sql queries.
To fix quick look, please post the file that mod is contained in and if you remember the line numbers also.< |
|
|
leatherlips
Senior Member
USA
1838 Posts |
|
leatherlips
Senior Member
USA
1838 Posts |
|
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 17 May 2008 : 17:10:54
|
phy1729 I have amended the inc_searchlog.asp as you have kindly suggested above, like leatherlips the error messages have disappeared but I get no results/No Matches Found. I have added a reply to a thread today with the word can't in it, so I would hope the searchmod.asp will extract it.. regards andy< |
|
|
Topic |
|