SqlSelect doesn't find text in textfield

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Sep 22 05:53:24 CDT 2008


On 9/22/08 12:02 PM, "Markus Fraefel" <markus.fraefel at futurestudios.ch>
wrote:

Hi Markus,

> I work with Director and Valentina database and need to search Valentina
> database fields of type 'Text' and 'String' for a searchTerm that is entered
> by the user. This works fine as long as the searchTearm contains 1 word or a
> part of 1 word without any special signs.
> 
> As soon as the searchTerm contains any special characters like (, %, ? etc.
> the search doesn't find any records although there are database fields, that
> contain those characters.
> 
> Also if the searchTerm contains 2 or more words (without special characters)
> the search doesn't find any records.
> 
> I am using the following Lingo code:
> 
> res = gDB.SqlSelect( "SELECT * FROM Seiten_de WHERE Lauftext LIKE '%" &
> searchTerm & "%'", #kServerSide, #kReadWrite, #kRandom )
> 
> What is wrong with this code?

* you may need read in docs about IndexByWords flag of Valentina
    then check your settings.

* to make work special chars as % inside of search terms you need to use
Valentina.EscapeString() on string from user

 res = gDB.SqlSelect(
    "SELECT * FROM Seiten_de WHERE Lauftext LIKE '%"
    & EscapeString(searchTerm)
    & "%'", 
    #kServerSide, #kReadWrite, #kRandom )


* about 2 words ... Should work if you use LIKE as written above.


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list