parameterised queries delphi

Hi: I am using delphi (in BDS 2006). It is great for interrogating paradox tables.
We have a manufacturing system based on paradox. We ALSO have an IDENTICAL system in SQL
I need to query  both paradox and SQL  to pull together the data.
The queries return all invoices for a date specified in edit1 box on the form.
Below are the two queries; Query1 on button1 is Paradox, ADOQuery1  on button3 is SQL
Paradox works fine; the SQL does not. The pkrase 'AsDate', fine in Query1, is rejected in the SQL query
Does anybody know how to get the SQL parameter to work in the same way as the Paradox query?  My attempts have been commented out ; the query works fine without them.

procedure TForm1.Button1Click(Sender: TObject);
Query1.SQL.Add('SELECT DISTINCT  D.OrderNo,D.InvNo, D.Invoiced, D.AccNo, D.CRef,D.Nett, D.VAT, D1.SLAcc' );
 Query1.SQL.Add(' FROM "GOOrders.DB" D, "GOAccs.DB" D1 WHERE D.AccNo = D1.AccNo AND  D.Invoiced = :SELMONTH  ORDER BY  D.AccNo');
 Query1.ParamByName('SELMONTH').AsDate := StrToDate(Edit1.Text);

procedure TForm1.Button2Click(Sender: TObject);

  lined : TDate;
  lined := (Date);
  Edit1.Text := DateToStr(lined);


procedure TForm1.Button3Click(Sender: TObject);
ADOQuery1.SQL.Add('SELECT Dbo_goorders.OrderNo, Dbo_goorders.InvNo,  Dbo_goorders.Invoiced, Dbo_goorders.AccNo, Dbo_goorders.cref, Dbo_goorders.Nett, Dbo_goorders.VAT, Dbo_goaccs.SLAcc');
ADOQuery1.SQL.Add('FROM GOOrders Dbo_goorders INNER JOIN GoAccs Dbo_goAccs ');
ADOQuery1.SQL.Add(' ON  (Dbo_goorders.Accno = Dbo_goAccs.Accno) ');
//ADOQuery1.SQL.Add('WHERE   Dbo_goorders.Invoiced = :SELMONTHd  order by Dbo_goorders.accno');
//ADOQuery1.Parameters.ParamByName('SELMONTHd'):= StrToDate(Edit1.Text);
Richard TeasdaleFinancial ControllerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard TeasdaleFinancial ControllerAuthor Commented:
Sorted! Panic over. Two lines; first sets datatype, second value

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PortletPaulEE Topic AdvisorCommented:
what is the final result of the query string ADOQuery1.SQL? can you display it? (and share it here)
PortletPaulEE Topic AdvisorCommented:
oh. OK.

I thought it may have been a missing space (e.g. in front of FROM)

I always suggest including a  leading space when appending to SQL query

ADOQuery1.SQL.Add(' FROM GOOrders Dbo_goorders INNER JOIN GoAccs Dbo_goAccs ');

Open in new window

Sinisa VukSoftware architectCommented:
Before closing... I suggest to use SQL property as text:
ADOQuery1.SQL.Text := 'select .. from table1 where '+
  'field1=:param1 and filed2=:param2';

Open in new window

...but I work mostly:
ADOQuery1.SQL.Text := 'select .. from table1 where '+
  'field1='+IntToStr(iParam1)+' and filed2='+QuotedStr(sParam2);

Open in new window

Richard TeasdaleFinancial ControllerAuthor Commented:
Answered my own question
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.