delphi程序出现计算金额的问题
来源:百度知道 编辑:UC知道 时间:2024/05/22 12:46:28
总是出现这个错误:
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(81): Missing operator or semicolon
[错误] Unit5.pas(64): Unsatisfied forward or external declaration:'TForm5.DataSource1DataChange'
[致命错误] Unit4.pas(32): Could not compile used unit 'Unit5.pas'
请问怎么修改呢?
程序如下:
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, DB, DBTables, StdCtrls, Mask;
type
TForm5 = class(TForm)
Label1: TLabel;
Shap
DataSet.FieldByName('ZGZ').Value := DataSet.FieldByName('JBGZ').Value +
DataSet.FieldByName('FDGZ').Value + DataSet.FieldByName('GLGZ').Value +
DataSet.FieldByName('CFBZ').Value + DataSet.FieldByName('JTBZ').Value;
注意自己处理转换数据类型的不同。
procedure DataSource1DataChange(Sender: TObject; Field: TField);
//这个过程没有内容,可以暂时去掉或更新内容
OnCalcFieds可以处理各类运算,你可以自己设置运算方法。
道理都是一样的,你可以在OnCalcFields里面添上
DataSet.FieldByName('ZKC').Value := DataSet.FieldByName('YLBX').Value + DataSet.FieldByName('SYBX').Value;
DataSet.FieldByName('SFGZ').Value := DataSet.FieldByName('ZGZ').Value - DataSet.FieldByName('ZKC').Value;
License is invalid or has expired
的意思是你的授权不合法或已过期,你需要找到合法的授权文件或是重新安装你的Delphi
你的程序看起来问题倒是不太大,但如果报TFORMx找不到的话,那只是Delphi环境的问题了吧,这些需要你慢慢研究了。