ASP.Net Custom Field From Query In DataSet
Posted
by
boruchsiper
on Stack Overflow
See other posts from Stack Overflow
or by boruchsiper
Published on 2011-02-13T23:20:19Z
Indexed on
2011/02/13
23:25 UTC
Read the original article
Hit count: 386
I added a new query to a table adapter in a DataSet. This query adds another field to the query whcih is a sum from another table. Here is the full query:
SELECT (SELECT COUNT(donationID) AS Expr1 FROM Donations AS da WHERE (dn.donorID = donorID)) AS Count, Solicitor, address1, address2, city, companyName, country, donorID, email, first, last, phoneHome, phoneMobile, phoneWork, state, webURL, zip, (select sum(amount) from Donations as dna where dna.donorID = dn.donorID) as SumDonations
FROM Donors AS dn order by last
The new field is represented in the last part of the query:
(select sum(amount) from Donations as dna where dna.donorID = dn.donorID) as SumDonations
I can preview the data in the xsd but the last field "SumDonations" is not showing up as a field I can add to my gridview. I rebuilt the website but no luck. What am I missing?
© Stack Overflow or respective owner