Board index » delphi » my SQL works fine in the BDE but not in my program

my SQL works fine in the BDE but not in my program

Im a little new at this so I assume I must be doing something wrong.
Below is the SQL code created by the qbe I tried to copy this into the
SQL strings property of a query, but I get no result. Im assuming it
has something to do with the where clause. I can take out the where
clause and get the table to populate with all the records at design
time and runtime. I need to know what to put in the query string to
extract a subset based on these words being contained in the field.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SELECT DISTINCT "inventory.DB"."Index", LotNumber, Description, Color,
Price, Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8,
Grid9, Grid10
FROM "inventory.DB"
WHERE
((Description LIKE '%coat') OR
 (Description LIKE '%coats') OR
 (Description LIKE '%siera') OR
 (Description LIKE '%rider') OR (Description LIKE '%parka'))
ORDER BY "inventory.DB"."Index", LotNumber, Description, Color, Price,
Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8, Grid9,
Grid10
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

any input greatly appreciated
Tom Campion Luc...@nando.net
-------------------------------------------------------------------------------------------------------

 

Re:my SQL works fine in the BDE but not in my program


Alright I tried the same code in Delphi16 and it works as expected.
Now I really don't know whats going on. Did I find a bug??
Quote
On Sat, 06 Apr 1996 15:53:44 GMT, luc...@nando.net wrote:
>Im a little new at this so I assume I must be doing something wrong.
>Below is the SQL code created by the qbe I tried to copy this into the
>SQL strings property of a query, but I get no result. Im assuming it
>has something to do with the where clause. I can take out the where
>clause and get the table to populate with all the records at design
>time and runtime. I need to know what to put in the query string to
>extract a subset based on these words being contained in the field.

>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>SELECT DISTINCT "inventory.DB"."Index", LotNumber, Description, Color,
>Price, Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8,
>Grid9, Grid10
>FROM "inventory.DB"
>WHERE
>((Description LIKE '%coat') OR
> (Description LIKE '%coats') OR
> (Description LIKE '%siera') OR
> (Description LIKE '%rider') OR (Description LIKE '%parka'))
>ORDER BY "inventory.DB"."Index", LotNumber, Description, Color, Price,
>Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8, Grid9,
>Grid10
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

>any input greatly appreciated
>Tom Campion Luc...@nando.net
>-------------------------------------------------------------------------------------------------------

Re:my SQL works fine in the BDE but not in my program


Quote
On Sat, 06 Apr 1996 15:53:44 GMT, luc...@nando.net wrote:
>Im a little new at this so I assume I must be doing something wrong.
>Below is the SQL code created by the qbe I tried to copy this into the
>SQL strings property of a query, but I get no result. Im assuming it
>has something to do with the where clause. I can take out the where
>clause and get the table to populate with all the records at design
>time and runtime. I need to know what to put in the query string to
>extract a subset based on these words being contained in the field.

>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>SELECT DISTINCT "inventory.DB"."Index", LotNumber, Description, Color,
>Price, Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8,
>Grid9, Grid10
>FROM "inventory.DB"
>WHERE
>((Description LIKE '%coat') OR
> (Description LIKE '%coats') OR
> (Description LIKE '%siera') OR
> (Description LIKE '%rider') OR (Description LIKE '%parka'))
>ORDER BY "inventory.DB"."Index", LotNumber, Description, Color, Price,
>Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8, Grid9,
>Grid10
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

>any input greatly appreciated
>Tom Campion Luc...@nando.net
>-------------------------------------------------------------------------------------------------------

Re:my SQL works fine in the BDE but not in my program


In article <3166912c.3763...@news.nando.net>, luc...@nando.net writes
Quote
>Im a little new at this so I assume I must be doing something wrong.
>Below is the SQL code created by the qbe I tried to copy this into the
>SQL strings property of a query, but I get no result. Im assuming it
>has something to do with the where clause. I can take out the where
>clause and get the table to populate with all the records at design
>time and runtime. I need to know what to put in the query string to
>extract a subset based on these words being contained in the field.

>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>SELECT DISTINCT "inventory.DB"."Index", LotNumber, Description, Color,
>Price, Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8,
>Grid9, Grid10
>FROM "inventory.DB"
>WHERE
>((Description LIKE '%coat') OR
> (Description LIKE '%coats') OR
> (Description LIKE '%siera') OR
> (Description LIKE '%rider') OR (Description LIKE '%parka'))
>ORDER BY "inventory.DB"."Index", LotNumber, Description, Color, Price,
>Lenght, Grid1, Grid2, Grid3, Grid4, Grid5, Grid6, Grid7, Grid8, Grid9,
>Grid10
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I too have been suffering with Local SQL and Paradox tables where there
is an OR operator in the WHERE clause. AND and AND NOT seem to be rock
solid, but OR either tells me I am asking one or more unrelated
questions or bombs out with a GPF in idqry01.dll. This is with Delphi
1.02.

Can you let me know if you learn a way round this?
--
Barney Tyrwhitt-Drake

Other Threads