Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 22674, The Power of Variants

by Mehmet Yüksek Email: Anonymous

Everybody mostly usage calculated fields, getting values from other tables or query, this example using Variants and return one or more columns only one command...
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 6.0  to 6.0 1219 downloads
Copyright: No significant restrictions

Size: 697 bytes
Updated on Fri, 22 Oct 2004 00:12:07 GMT
Originally uploaded on Thu, 21 Oct 2004 01:20:17 GMT
SHA1 Hash: 43A0D88D21F2EB392697FC48B2D3607BB7E51827
MD5 Hash: 7983DEFEF962E08D9D17B5532B88CFBC

    Explore the files in this upload

This is a Very Useful Function for applications,
(note: Im tested only on D6)

procedure TfrmList.myQueryCalcFields(DataSet: TDataSet);
Res: Variant;
Res := Dm1.GetValuesFromDB('SELECT LastName, FirstName FROM EMPLOYEE WHERE EmpNo='+myQueryEmpNo.asString,
['LastName','FirstName' {...} ]);

If not VarIsEmpty(Res) then //Check the Unassigned
myQueryCalcLastNAME.Value := Res[0];
myQueryCalcFirstNAME.Value := Res[1];


Res := GetValuesFromDB('SELECT a,b,c FROM TBL1 WHERE ROWID=1',['A','C']);

If not VarIsEmpty(Res) then
ShowMessage('Result A:'+ Res[0] );
ShowMessage('Result C:'+ Res[1] );

Res := GetValuesFromDB('SELECT L.*, R.* FROM TABLE1 LEFT JOIN TABLE2 R ON (R.ID=L.ID) WHERE L.ID=100',['A','B','C','D','E']);

If not VarIsEmpty(Res) then
Res[0] //--> Referenced to results of 'A' field
Res[4] //--> Referenced to results of 'E' field
Sorry my bad English,
Good Bye...

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04