Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   calculo en dbgrid (https://www.clubdelphi.com/foros/showthread.php?t=32667)

dariana20 12-06-2006 21:13:33

calculo en dbgrid
 
Necesito saber como lograr q un campo de un dbgrid me muestre el resultado
de la multilplicacion de otros dos.Estoy trabajando con sql server.
???????:(

delphi.com.ar 12-06-2006 21:32:43

Puedes hacerlo desde la consulta:
Código SQL [-]
SELECT CAMPO1, CAMPO2, CAMPO1*CAMPO2 PRODUCTO FROM TABLA
O con campos calculados:
Cita:

Empezado por Ayuda de Delphi
To create a calculated field in the New Field dialog box:

1 Enter a name for the calculated field in the Name edit box. Do not enter the name of an existing field.
2 Choose a data type for the field from the Type combo box.
3 Enter the size of the field in the Size edit box, if appropriate. Size is only relevant for fields of type TStringField, TBytesField, and TVarBytesField.

4 Select Calculated or InternalCalc in the Field type radio group. InternalCalc is only available if you are working with a client dataset. The significant difference between these types of calculated fields is that the values calculated for an InternalCalc field are stored and retrieved as part of the client dataset's data.
5 Choose OK. The newly defined calculated field is automatically added to the end of the list of persistent fields in the Field editor list box, and the component declaration is automatically added to the form's or data module's type declaration.

6 Place code that calculates values for the field in the OnCalcFields event handler for the dataset. For more information about writing code to calculate field values, see Programming a calculated field.

Saludos!


La franja horaria es GMT +2. Ahora son las 19:47:20.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi