sql command

adeline

New member
Joined
Apr 11, 2006
Messages
2
daNamePhone = New SqlCeDataAdapter ("SELECT SUM(nec_amo) where nec_type = Food As total from nec", ssceconn)

is this sql command correct?
 
Without knowing the database schema (or any other details) it is difficult to say, on the face of it the sql seems valid though.

Was this a question driven by idle curiosity or are you having problems with the statement?
 
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. :)

-ner
 
Back
Top