1、我在进行计算时,如果得到负数应该怎么让其显示在Label.caption中呢?我下面的代码为负数就出错了。
Label2.Caption:=IntToStr(StrToInt(srje.Caption)-StrToInt(kzje.Caption))+' 元';
2、下面是取当月现金的总和。不能显示结果,请达人指点。
with DataModule1.ADOfind do
begin
close;
SQL.Clear;
SQL.Add('select Sum(dataMoney) as sr from data where ');
SQL.Add('datalx=''入帐'' and datadate between '+FormatDateTime('yyyy-mm-01',now)+ ' and ' +FormatDateTime('yyyy-mm-31',now));
Open;
end;label1.caption:=DataModule1.ADOfind.FieldByName('sr').Asstring + ' 元';
Label2.Caption:=IntToStr(StrToInt(srje.Caption)-StrToInt(kzje.Caption))+' 元';
2、下面是取当月现金的总和。不能显示结果,请达人指点。
with DataModule1.ADOfind do
begin
close;
SQL.Clear;
SQL.Add('select Sum(dataMoney) as sr from data where ');
SQL.Add('datalx=''入帐'' and datadate between '+FormatDateTime('yyyy-mm-01',now)+ ' and ' +FormatDateTime('yyyy-mm-31',now));
Open;
end;label1.caption:=DataModule1.ADOfind.FieldByName('sr').Asstring + ' 元';
解决方案 »
- 关于在delphi2010下Stringlist对ansiString不全支持的问题,请遇见过的网友给个建议
- MediaPlayer控件问题,如果判断是否正在播放中?????????????????
- 如何把一个字符串写入到缓冲区?
- 这样的程序,怎么写?
- 一个全新的问题,等待你来解决!!!(分不够出一声)
- 哪位先生知道在Delphi下怎样进行强制类型转换?高分相送呀
- interface类型的资源应该由谁负责释放?
- 心情不好,请大家进来领分!(关于TMediaPlayer控件和RES文件)
- 我想在LISTVIEW中显示一列数据,该如何写?
- 请问,delphi调用vc的dll时,两种语言的不同的数据类型如何转换?
- datetimepicker的Time和date
- delphi中dll文件的pchar怎样释放内存?急?在线等
with DataModule1.ADOfind do
begin
close;
SQL.Clear;
SQL.Add('select Sum(dataMoney) as sr from data where ');
SQL.Add('datalx=''入帐'' and datadate between '''+FormatDateTime('yyyy-mm-01',now)+ ''' and ''' +FormatDateTime('yyyy-mm-31',now)+'''');
Open;
end; label1.caption:=DataModule1.ADOfind.FieldByName('sr').Asstring + ' 元';
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class EOleException with message 'Data type mismatch in criteria expression'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
begin
close;
SQL.Clear;
SQL.Add('select Sum(dataMoney) as sr from data where ');
SQL.Add('datalx=''入帐'' and datadate between {'+FormatDateTime('yyyy-mm-01',now)+ '} and {' +FormatDateTime('yyyy-mm-31',now)+'}');
Open;
end; label1.caption:=DataModule1.ADOfind.FieldByName('sr').Asstring + ' 元';