As far as the SQL code goes, in all the databases Ive worked with you must have the FROM before the WHERE clause. If the alias is for the column, you need to move that, too. See this:
Code:
Change:
SELECT SUM(nec_amo) where nec_type = Food As total from nec
To:
SELECT SUM(nec_amo) As total from nec where nec_type = Food
As far as the .NET code, thats harder to tell. There are lots of assumptions to make - for example, is daNamePhone declared to be a DataAdapter or some derived type?
I hope this is sample code as Im not sure how the name daNamePhone, which implies something about a name and a phone, relates to the query which appears to be the sum of something based on a food.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.