Topic: Using if clause with SQLQuery

Hello Dmitry and MVD users,
Please what will be the right way to achieve this

if SQLQuery('SELECT sellprice,buyprice,quantity FROM stock WHERE id=' + frmProPur.cbProduct.sqlvalue, Results) then//No error from database or query
   begin
   frmProPur.edSellPrice.text := Results.FieldByName('sellprice').AsString;
   frmProPur.edBuyPrice.text := Results.FieldByName('buyprice').AsString;
   frmProPur.edQtyAvail.text := Results.FieldByName('quantity').AsString;
   frmProPur.edTotal.Value :=    Results.FieldByName('buyprice').AsFloat * frmProPur.edQty.Value;
   end
   else//if there is error with connection, query etc
    ShowMessage(sellPrice);

Regards

@thezimguy

Re: Using if clause with SQLQuery

Hello.


Please provide more info about your question.

Dmitry.