query5_1.cpp

来自「校园刷卡系统」· C++ 代码 · 共 40 行

CPP
40
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Query5_1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

extern void HISQuery(TQuery*qPtr,String&s,bool b);

TQueryForm5_1 *QueryForm5_1;
//---------------------------------------------------------------------------
__fastcall TQueryForm5_1::TQueryForm5_1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TQueryForm5_1::FormActivate(TObject *Sender)
{
String sql="select ID,name,amount,price from StorageGoods";
double pay=0,temp;

HISQuery(Query1,sql,true);
if(!Query1->IsEmpty())
{
while(!Query1->Eof)
{
temp=(Query1->FieldByName("amount")->AsInteger)*(Query1->FieldByName("price")->AsFloat);
pay+=temp;
Query1->Next();
}
}
Label2->Caption=pay;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?