Board index » delphi » Problem with DataSet.CommandText and *two* parameters
Roland Reuss
![]() Delphi Developer |
Problem with DataSet.CommandText and *two* parameters2004-08-24 08:24:10 PM delphi190 Hi, my problem is, in short: I have two input-fields. Their values are passed to a DataSet.CommandText via parameters (:sucha and :suchb) and the query should look for combinations of the two values in the mysql-database. In general the query should look for :sucha in all fields of the database ('OR' combination) AND :suchb in all fields of the same database (again 'OR' combination) The query works OK when I restrict it to the first field, so it seems to me, that the parameters are set correct and have been assigned a correct value: <snip> ClientDataSet1.CommandText :='select * from `biblio` '+ 'where autor like :sucha '+ 'AND autor like :suchb'; <snip> Now, when I extend the query over two fields I will get the message that the value for the second parameter is missing and the program stops executing: <snip> ClientDataSet1.CommandText :='select * from biblio '+ 'where (autor like :sucha ' 'OR titel like :sucha) '+ 'AND (autor like :suchb'+ 'OR titel like :suchb)'; <snip> I tried all kinds of bracketing, all with the same result. What am I doing wrong? Thanks in advance, Roland Delphi6 (Update 2), MySQL 4.017 |