List Info

Thread: ADOQuery Problem




ADOQuery Problem
user name
2006-06-19 07:57:43

Number parameters should not be enclosed in quote marks, so your query should read
br> ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * ');
ADOQuery1.SQL.Add('from lb' );
ADOQuery1.SQL.Add('Where Prov ='''+ edit11.text +'''' );// this field is text
ADOQuery1.SQL.Add('AND Para =''' + edit14.text +'''' );// this field is text
ADOQuery1.SQL.Add('AND Tp =''' + edit15.text + '''' );// this field is text
ADOQuery1.SQL.Add('AND Utm = ' + edit6.text + ' );// this field is number
ADOQuery1.SQL.Add('AND Precio <= ' + edit8.text + ' );// this field is number

Personally I also surrond Text parameters with double quotes to make them easier to read, thus making your SQL

ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * ');
ADOQuery1.SQL.Add('from lb' );
ADOQuery1.SQL.Add('Where Prov ="'+ edit11.text +'"' );// this field is text
ADOQuery1.SQL.Add('AND Para ="' + edit14.text +'"' );// this field is text
ADOQuery1.SQL.Add('AND Tp ="' + edit15.text + '"' );// this field is text
ADOQuery1.SQL.Add('AND Utm = ' + edit6.text + ' );// this field is number
ADOQuery1.SQL.Add('AND Precio <= ' + edit8.text + ' );// this field is number

HTH

Paul Bennett

> ----- Original Message -----
>; From: "Arsen Khachatryan" <cragreryahoo.com>
> To: delphi-enyahoogroups.com
&gt; Subject: [delphi-en] ADOQuery Problem
&gt; Date: Sat, 17 Jun 2006 01:26:22 -0700 (PDT)
>;
>
> Hello who can help me with query.I have a multi search insid DB
> (its in ms access)
&gt; but it gives a error and can't understand what to do
> the code
>
> ADOQuery1.Active :=true;
&gt; ADOQuery1.Close;
>; ADOQuery1.SQL.Clear;
> ADOQuery1.SQL.Add('select * ');
> ADOQuery1.SQL.Add('from lb' );
> ADOQuery1.SQL.Add('Where Prov ='''+ edit11.text +'''' );// this field is text
> ADOQuery1.SQL.Add('AND Para =''' + edit14.text +'''' );// this field is text
> ADOQuery1.SQL.Add('AND Tp =''' + edit15.text + '''' );// this field is text
> ADOQuery1.SQL.Add('AND Utm = ''' + edit6.text + '''' );// this field is number
&gt; ADOQuery1.SQL.Add('AND Precio <= ''' + edit8.text + '''' );// this
> field is number
&gt; AOQuery1.Open;
>
> thank you
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger&amp;#8217;s low PC-to-Phone call rates.
&gt;
> [Non-text portions of this message have been removed]

>

Experience is something you don't get until just after you need it.

--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com

Powered by Outblaze

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )