1 (edited by kim143 2017-05-17 12:04:28)

Topic: Could not convert variant of type (UnicodeString) into type (Double)

procedure Form3_Button1_OnClick (Sender: string; var Cancel: boolean);

begin

if form3.edit6.text + sqlexecute('select sum(ifnull(process, 0) + ifnull(unprocess, 0)) from out where id_sub =' +inttostr(form3.combobox1.dbitemid)) > sqlexecute('select gram from sub where id ='+inttostr(form3.combobox1.dbitemid)) then showmessage ('Not Allowed');
if form3.edit6.text + sqlexecute('select sum(ifnull(process, 0) + ifnull(unprocess, 0)) from out where id_sub =' +inttostr(form3.combobox1.dbitemid)) <= sqlexecute('select gram from sub where id ='+inttostr(form3.combobox1.dbitemid)) then form3.button3.click;

// if I disable below it works fine or if i put this in different button click event than both code above and below works fine.

if form3.edit4.text + sqlexecute('select sum(ifnull(process, 0) + ifnull(unprocess, 0)) from out where id_sub =' +inttostr(form3.combobox1.dbitemid)) > sqlexecute('select gram from sub where id ='+inttostr(form3.combobox1.dbitemid)) then showmessage ('Not Allowed');
if form3.edit4.text + sqlexecute('select sum(ifnull(process, 0) + ifnull(unprocess, 0)) from out where id_sub =' +inttostr(form3.combobox1.dbitemid)) <= sqlexecute('select gram from sub where id ='+inttostr(form3.combobox1.dbitemid)) then form3.button3.click;

end;

what is wrong here??

Could not convert variant of type (UnicodeString) into type (Double)

Re: Could not convert variant of type (UnicodeString) into type (Double)

You can't use a property "Text" for mathematical operation, try to use a property Value

if form3.edit6.Value + sqlexecute('...


Also instead

inttostr(form3.combobox1.dbitemid)

you can use

form3.combobox1.sqlValue
Dmitry.

Re: Could not convert variant of type (UnicodeString) into type (Double)

thank you @Dmitry 

can you please help me with this issue

http://myvisualdatabase.com/forum/viewtopic.php?id=3372