In an attempt to come up with a solution for my previous situation:
http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_23785540.htmlI figured I am able to get the distinct column values (in this case, it would be the date 1/1/2008 and 1/2/2008) and I'm going to run an SQL query to sum(money1 to 7) in it.
For Example:
Customer Name CustomerID Date Number Money1 Money2,3,4... Money7
'John Smith' 1 1/1/2008 1234 $10 ...etc.... $15
'Joe Dawg' 2 1/1/2008 1235 $5 ...etc.... $10
-Total Row Inserted Here - $15 ...etc.... $25
'Jennifer Smith' 3 1/2/2008 1236 $20 ...etc.... $5
'Jack Dawg' 4 1/2/2008 1237 $30 ...etc.... $20
-Total Row Inserted Here - $50 ...etc.... $25
I currently have a 'For-Next' statement that allows me to query the sum of the records that I need to show (for example: Select sum(money1),sum(money2)...
sum(money7
) from table where date ='1/1/2008'. It puts the record into a dataset / table and shows it in the datagridview. Then it goes back again and runs the next statement (for example... Select sum(money1),sum(money2)...
sum(money7
) from table where date ='1/2/2008'). It then puts the results into a dataset / table and shows it in the datagridview. My problem is that it clearly removes the records that it contained the first time. Now it's only showing the info for 1/2/2008.
Is there a way to declare a dataset / adapter / table outside of the for-next loop and use it to combine into one datasource? Is there another way I can do this to have the one datagridview show a number of different SQL select statements (all containing 1 row each and having the exact same columns)?
Start Free Trial