sSQL.Append(" SELECT 'X' ");
sSQL.Append(" FROM ProfileInsurancePlanYear ");
sSQL.Append(" WHERE ProfileID = " + profileid.ToString() + " AND CropYear = " + cropyear.ToString());
This was a query that was originally hitting an access back end. I have moved it over to SQLCE and am perplexed about what this query is supposed to do.
The table structure it hits is:
ProfileID
InsurancePlanID
CropYear
INsurance_Price
Levels_XML
I am assuming this would select something from the Levels_XML column where the profileid and cropyear match?
Does this even work in sqlCE?
This type of query is typically used to see if a row exists. If a row is found, the query will return a single character, X. Otherwise, it will be an empty result set... You could also say
sSQL.Append(" SELECT count(*) ");
sSQL.Append(" FROM ProfileInsurancePlanYear ");
sSQL.Append(" WHERE ProfileID = " + profileid.ToString() +
" AND CropYear = " + cropyear.ToString());
Which will return a result with either 0 or some positive number. Different approaches both asking the database simply to indicate whether or not any records existing matching the condition.