i want to sum or count field id, but i got message "
A field or property with the name 'id' was not found on the selected data source.
"
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT sum([id]) FROM [penjualan] GROUP BY [name]">
</asp:SqlDataSource>
Member
15 Points
50 Posts
sum or count in sql data source
Feb 29, 2016 12:31 AM|motorrevo00|LINK
i want to sum or count field id, but i got message "
A field or property with the name 'id' was not found on the selected data source.
"
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT sum([id]) FROM [penjualan] GROUP BY [name]">
</asp:SqlDataSource>
thanks before
Member
15 Points
50 Posts
Re: sum or count in sql data source
Feb 29, 2016 01:02 AM|motorrevo00|LINK
SOLVED
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [id_pembelian], SUM([harga]) as x FROM [penjualan] GROUP BY [id_pembelian]">
</asp:SqlDataSource>
in bounfield datafield="x"