Microsoft
Software
Hardware
Network
Question : Using the Sum operator within a DataView rowfilter
Is there a way to sum a column within a Dataview Rowfilter? I'm trying to use the following filter but I'm getting an error:
Dim View As DataView = New DataView(Me.CyclingJournal
_DataDataS
et.Tables(
"Events"))
View.RowFilter = "Select Sum(Distance) As SumOfDistance where Date >= '" & g_MonthBegin & "' and Date <= '" & g_MonthEnd & "' and RideType = '" & p_RideType & "'"
I get an error saying "Syntax error: Missing operand after 'Sum' operator."
Thanks for any help!
Answer : Using the Sum operator within a DataView rowfilter
Sorry, DataView.RowFilters do not support aggregrate functions
However, you can perform that calculation using the Compute method of the DataTable class (as razo has already pointed out)
The problem is that you can't do that inside the DataView control. So, that means you should calculate the the sum separately and display it separately.
BTW: If you're interested in reading more about how to perform SQL-style select statements on DataTables, you might wanna check out:
http://home.hot.rr.com/gra
ye/Article
s/SQL_Engi
ne.htm
Random Solutions
Exchange 2007 to 2010 upgrade
Pass Web Page as Parameter to Class in App_Code Folder
video card driver
How to restrict on categories with recurrent items using VBA in access
active directory, W2k8 R2 DC, Kerberos failures, Event ID: 3, 4771, 4769, 4768, 4776, 4625 source: Microsoft Windows security
Access attaching a file as xls when it should be rtf
insert image via bookmark
Same form on different computers
Outlook 2007 Continuous Authencication
XP display set to 4 bit color depth after Remote Desktop session