SELECT ForumForums.*, ForumReplys.*, ForumTopics.* FROM (ForumForums LEFT JOIN ForumTopics ON ForumForums.Forum_ID = ForumTopics.Forum_id) LEFT JOIN ForumReplys ON ForumTopics.Topic_ID = ForumReplys.Topic_ID WHERE (ForumForums.F_Description LIKE '%[%' OR ForumReplys.R_Message LIKE '%[%' OR ForumTopics.T_Message LIKE '%[%' ) ORDER BY ForumTopics.topic_id
Från följande SQL sats får jag felet:
Microsoft JET Database Engine fel '80040e14'
Invalid pattern string
Det uppstår när jag matar in ett [ tecken i sökfältet som "kodas om" till LIKE '%[%' ... Hur ska man göra för att undgå detta?
------------------ "It's not where ya from it's where ya at"
Helsjukt fel...
Jag gjorde i alla fall en funktion som fixar till strängen innan den körs i databasen (escape funkade inte i access):
' Sjuk buggfix:
' Gör om [ till [] om det inte finns någon ] i strängen.
' Ex: "Hesjan [hoppsan" blir "Hejsan []hoppsan".
Function convChar(tmp)
If inStr(tmp, "[") And Not inStr(tmp, "]") Then
tmp = Replace(tmp, "[", "[]")
End If
convChar = tmp
End Function
------------------ "It's not where ya from it's where ya at"