I get an error 'syntax error or access violation' in MSQuery's Prepare method using parameters in a join condition.
E.g. try following similar code on Northwind:
MSQuery1->SQL->Clear();
MSQuery1->SQL->Add("select * from Products p");
MSQuery1->SQL->Add(" join Suppliers s on s.SupplierID = :pSID");
MSQuery1->SQL->Add(" where p.SupplierID = :pSID");
MSQuery1->ParamByName("pSID")->AsInteger = 4;
MSQuery1->Prepare();
MSQuery1->Open();
Replace the problematic line with
MSQuery1->SQL->Add(" join Suppliers s on s.SupplierID = 4");
or with
MSQuery1->SQL->Add(" join Suppliers s on s.SupplierID = "+IntToStr(4));
and it works. What's wrong ?