We help IT Professionals succeed at work.

How to use acos, cos, sin functions in asp.net DataView.RowFilter

lenguyen0366
lenguyen0366 used Ask the Experts™
on
I need to do some distance calculation given the latitude and longitude.  When I put the calculation in the stored procedure, the calculation works fine, but when I need to put that calculation in the DataView.RowFilter, those functions are not recongnized even though I have System.Math name space imported.  Is it possible to use acos, cos, and sin functions in DataView.RowFilter?

Thank you
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
What error do you get? What does your code look like? I am guessing here but does ur rowfilter combine both strings and int's? If so you will get cannot perform operation on System.Int32 and System.String. The fix for that is converting your int's to strings like so System.Convert.ToString(integer_here).
Most Valuable Expert 2012
Top Expert 2014
Commented:
No.

RowFilter supports very limited functionality.

Here is explanation of what is supported in RowFilter

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

Author

Commented:
Thank you for your replies.  I think CodeCruiser is right.  RowFilter in DataView just supports some functionalities.  I will try DataTable.Select to see if that will do it.  If not, I probably have to go back to doing the calculation inside the stored procedure and let sql server handles the job.  

Author

Commented:
I got it worked out.  Thank you all for your replies.