Hello santran0331
thanks for your answer.
I have tried to change the label, put it in brackets and the same problem, it doesn't find it as a field.
Could it be that i need to bound the fileds through the code?
Main Topics
Browse All Topicshello I have a gridview that needs to be filled by a datasource with the following Command:
SELECT Sum(Price) as TOTAL
FROM Products
WHERE (CountryCode = 1)
I have added the column "TOTAL" through the "Edit Columns" menu but when I run the application I get the following error:
A field or property with the name 'TOTAL' was not found on the selected data source
[HttpException (0x80004005): A field or property with the name 'TOTAL' was not found on the selected data source.]
The application works fine if I not use computed values, e.g "select Price from products" and choosing the column Price.
This might be an easy solution but I have been searching for hours with no joy so any help is welcome. I am giving 500 points as I need to solve this problem urgently.
thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
yes
here it is:
"I have called the result Tot":
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
<Columns>
<asp:BoundField DataField="Tot" HeaderText="Tot" SortExpression="Tot" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SQLDataSourceAbsenceRe
ConnectionString="<%$ ConnectionStrings:AbsenceC
</asp:SqlDataSource>
there were some strange characters in the copy paste for the sql datasource, just ignore them, the code is:
<asp:SqlDataSource ID="SQLDataSourceAbsenceRe
ConnectionString="<%$ ConnectionStrings:AbsenceC
</asp:SqlDataSource>
Business Accounts
Answer for Membership
by: samtran0331Posted on 2007-01-07 at 15:46:44ID: 18263697
couple things to try,
1. put square brackets around TOTAL:
SELECT SUM(Price) AS [TOTAL]
...
or
2. don't call it TOTAL
SELECT SUM(Price) as [TheTotal]
....
just thinking that "total" might be getting interpreted as a keyword by something and not a field...usuallly, when I do sums, I call them things like "PriceTotal" ...etc and have never had problems...