Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use Count,Calculate sum(), Caluculate Max() in VB.NET? 2

Status
Not open for further replies.

Mahey

Programmer
Dec 24, 2008
52
SA
Hi
Thanks in Advace.

In VFP9 we can use the followings and How to do it with vb.net?

COUNT FOR(wk_code='Inj ') TO abcd5
CALCULATE SUM(total_hr) FOR (emp_id=epidi1) TO tot1
CALCULATE MAX(en_date) FOR((emp_id=epidi1) TO etydt

--------------------------------------------
In Vb.Net

Dim dbnd1 As New BindingSource
dbnd1.DataSource = DTB4 'Datatable for SEC-ID's


Thanking By
Mahey
 
There's a newer library in .Net to do some of this stuff called LINQ (Language Integrated Query). I haven't yet used it myself, but you can get some information for it here:

Previously, you would perform these types of calculations as you would with most 3GL languages--lots of loops.
 
Why not scalar queries?
Search for ExecuteScalar

Zameer Abdulla
 
That's fine if you can go back to the database to execute another query, but if the data is already contained in some sort of collection, it's not always an option. But yes I agree, if you are working with a database, try to have the database engine do the lifting for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top