Hi.
I'm new to ASP.Net and I'm running into a simple problem (I think).
I'm trying to get 2 values from 2 separate queries into 2 different
variables. I would then like to take the difference of the two
varaibles and place it into a label on an .aspx page.
Basically,
MyGrossSales = GrossSales from query
MyTotalCredit = TotalCredit from query
MyLabel = MyGrossSales - MyTotalCredit
I can retrieve data and place it into a repeater and/or other data
controls, but I've not found a way to get data into a variable(s) to be
used in code.
Can someone help me with this? Am I on the right track? Is there a
better (or simpler) way to accomplish this?
Here's what I have so far.
----------------- Start of Code ----------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New SqlConnection(" Server=MyServer ;Integrated
Security=True;D atabase=MyDatab ase")
MyCommand = New SqlDataAdapter( "SELECT SUM(tot_dollars ) AS
GrossSales FROM OEORDHDR_SQL WHERE (ord_type = 'I')", MyConnection)
DS = New DataSet
MyCommand.Fill( DS, "GrossSales ")
Repeater1.DataS ource = DS
Repeater1.DataB ind()
Dim DS_2 As DataSet
Dim MyConnection_2 As SqlConnection
Dim MyCommand_2 As SqlDataAdapter
MyConnection_2 = New SqlConnection(" Server=MyServer ;Integrated
Security=True;D atabase=MyDatab ase")
MyCommand_2 = New SqlDataAdapter( "SELECT SUM(tot_dollars ) AS
TotalCredits FROM OEORDHDR_SQL WHERE (ord_type = 'C')", MyConnection_2)
DS_2 = New DataSet
MyCommand_2.Fil l(DS_2, "TotalCredi ts")
Repeater2.DataS ource = DS_2
Repeater2.DataB ind()
End Sub
----------------- End of Code ---------------
I've also read about getting data via something like
DS.Tables.Item( 0).Rows(0)("Gro ssSales"), but I have not figured out how
to use it.
Thank you for your help,
j.t.w