Topic: Error

Can any one tell about this kind of attached pic? How it come up and what is its sulution?

Post's attachments

Attachment icon Capturex.PNG 3.26 kb, 65 downloads since 2022-03-15 

Re: Error

Hello unforgettable

How difficult to answer you.
Let us know under what conditions this appears:
SQL query, calculation between several values, variable definition error...
There can be several explanations.
Give us an example of your project and tell us after which operation this occurs.
JB

Re: Error

It appear while calculation between several values.

When values from corresponding field is empty.

Re: Error

To re-iterate what JB has written, without seeing your project, you are very unlikely to get any sort of help.
Derek.

Re: Error

Hi derek,
           I got this kinf of  error " could not convert variant of type(unicodestring) into type(double) by typing following script.
Reception.Edit1.Value:= SQLExecute('Select Sum((Advance)+(Received)) from Fees Where Date(sdate1) = "' + FormatDateTime('YYYY-MM-DD',Reception.dtp.DateTime) + '"');

Reception.Edit2.Value:= SQLExecute('Select Sum((paid)+(lpaid)) from Expenses Where Date(date1) = "' + FormatDateTime('YYYY-MM-DD',Reception.dtp.DateTime) + '"');

Reception.Edit3.Value:= SQLExecute('Select Sum((Advance)+(Received)) from Fees Where Date(sdate1) = "' + FormatDateTime('YYYY-MM-DD',Reception.dtp.DateTime) + '"')-SQLExecute('Select Sum((paid)+(lpaid)) from Expenses Where Date(date1) = "' + FormatDateTime('YYYY-MM-DD',Reception.dtp.DateTime) + '"');

any solution?

Re: Error

I think you have to change edit.value to edit.text or vartostr(sqlquery)
Try both options

Re: Error

I tried edit.value to edit.text but still I got that error message. Can you tell about other option vartostr(sqlguery)?

8 (edited by sparrow 2022-03-23 11:32:24)

Re: Error

bllackpearl is right.
Replace
Reception.Edit1.Value on Reception.Edit1.Text
Reception.Edit2.Value on Reception.Edit2.Text


and modify last
Reception.Edit3.Value:= Reception.Edit1.Value - Reception.Edit2.Value;


OR


Reception.Edit1.Value:= SQLExecute('Select IFNULL(Sum((Advance)+(Received)),0) from Fees ...
Reception.Edit2.Value:= SQLExecute('Select IFNULL(Sum((paid)+(lpaid)),0) from Expenses ...
and modify last
Reception.Edit3.Value:= Reception.Edit1.Value - Reception.Edit2.Value;


In addition, SQLExecute is a very simple function and can only output one result.
If the result contains several values, only the first one will be returned, which will be an error.

Re: Error

Thank you every one.
It works correctly. Can you explain this error in some detail, sparrow?

Re: Error

The returned result can be NULL, which results in an error.
Solutions two
1 Use (edit1.text ...)
2 Exclude possibility of NULL result in SQL query IFNULL ( ,0)

Re: Error

Hi sparrow,
             Thank you sparrow to guide.