I have the following code in aspx file. It will pull the Saleman Name Gross Sales Product Freight Delivery Other Product Cost Freight Cost Delivery Cost
Is there anyway I can sort the output by Name.. and since Name will show up a couple times with diff. Sales each time combine all the similar Name and have the Sum of Gross Sales, Product, Freight Delivery, etc show up?
Thanks in advance.
script runat="server">
Sub Button_Click( s As Object, e As EventArgs )
Dim myConnection As oledbConnection
Dim strselect As String
Dim myCommand As oledbCommand
Dim dtmdate as datetime
dtmdate= datetime.now()
myconnection = new oledbconnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\data\plmaster.mdb")
strselect = "select ardetail.ri_saleman as [Saleman] , plmaster.pl_name as [Name] , ardetail.ri_grs_amt as [Gross Sales] ,
ardetail.ri_product as [Product] , ardetail.ri_freight as [Freight] , ardetail.ri_delvery as [Delivery] , ardetail.ri_design as
[Other] , ardetail.ri_invcost as [Product Cost], ardetail.ri_frtcost as [Freight Cost] , ardetail.ri_dlvcost as [Delivery Cost]
from ardetail, plmaster where ardetail.ri_proname = plmaster.pl_file and ardetail.ri_invdate>#12/31/2003# and
ardetail.ri_invdate<#01/01/2005# and ardetail.ri_trantyp='i'"
mycommand = new oledbcommand ( strselect, myconnection )
response.write(dtmdate.tostring ("D"))
myConnection.Open()
DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()
End Sub
/script>
Is there anyway I can sort the output by Name.. and since Name will show up a couple times with diff. Sales each time combine all the similar Name and have the Sum of Gross Sales, Product, Freight Delivery, etc show up?
Thanks in advance.
script runat="server">
Sub Button_Click( s As Object, e As EventArgs )
Dim myConnection As oledbConnection
Dim strselect As String
Dim myCommand As oledbCommand
Dim dtmdate as datetime
dtmdate= datetime.now()
myconnection = new oledbconnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\data\plmaster.mdb")
strselect = "select ardetail.ri_saleman as [Saleman] , plmaster.pl_name as [Name] , ardetail.ri_grs_amt as [Gross Sales] ,
ardetail.ri_product as [Product] , ardetail.ri_freight as [Freight] , ardetail.ri_delvery as [Delivery] , ardetail.ri_design as
[Other] , ardetail.ri_invcost as [Product Cost], ardetail.ri_frtcost as [Freight Cost] , ardetail.ri_dlvcost as [Delivery Cost]
from ardetail, plmaster where ardetail.ri_proname = plmaster.pl_file and ardetail.ri_invdate>#12/31/2003# and
ardetail.ri_invdate<#01/01/2005# and ardetail.ri_trantyp='i'"
mycommand = new oledbcommand ( strselect, myconnection )
response.write(dtmdate.tostring ("D"))
myConnection.Open()
DataGrid1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()
End Sub
/script>