Home > Back-end >  C builder how to Max value is assigned to a variable of a select statement
C builder how to Max value is assigned to a variable of a select statement

Time:09-24

Excuse me, how to use c + + builder6.0 will found out t Max value is assigned to a variable, such as: select Max (xuhao) from table1

CodePudding user response:

Can you like this:
The select Max (xuhao) as max_xuhao from table1
T=ADOQuery1 - & gt; FieldValues [" max_xuhao "] - & gt; AsInteger;

CodePudding user response:

reference 1st floor u010165006 response:
can like this:
The select Max (xuhao) as max_xuhao from table1
T=ADOQuery1 - & gt; FieldValues [" max_xuhao "] - & gt; AsInteger;


T=ADOQuery1 - & gt; FieldValues [" max_xuhao "];

CodePudding user response:

refer to the second floor u010165006 response:
Quote: refer to 1st floor u010165006 response:

Can you like this:
The select Max (xuhao) as max_xuhao from table1
T=ADOQuery1 - & gt; FieldValues [" max_xuhao "] - & gt; AsInteger;


T=ADOQuery1 - & gt; FieldValues [" max_xuhao "];


Or:
T=ADOQuery1 - & gt; FieldByName (" max_xuhao ") - & gt; AsInteger;//it is clear

CodePudding user response:

CodePudding user response:

FieldValues [] is, the Variant data type conversion between it and common data type that speed is slow, when handling a large amount of data is best TField: : AsInteger series As attributes, such As

CodePudding user response:

reference u010165006 reply: 3/f
Quote: refer to the second floor u010165006 response:

Quote: refer to 1st floor u010165006 response:

Can you like this:
The select Max (xuhao) as max_xuhao from table1
T=ADOQuery1 - & gt; FieldValues [" max_xuhao "] - & gt; AsInteger;


T=ADOQuery1 - & gt; FieldValues [" max_xuhao "];


Or:
T=ADOQuery1 - & gt; FieldByName (" max_xuhao ") - & gt; AsInteger;//it is clear
  • Related