adeline Posted April 11, 2006 Posted April 11, 2006 daNamePhone = New SqlCeDataAdapter ("SELECT SUM(nec_amo) where nec_type = 'Food' As total from nec", ssceconn) is this sql command correct? Quote
Administrators PlausiblyDamp Posted April 11, 2006 Administrators Posted April 11, 2006 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? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
*Experts* Nerseus Posted April 11, 2006 *Experts* Posted April 11, 2006 As far as the SQL code goes, in all the databases I've 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: 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, that's 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 I'm 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.