scorpion53061
asked on
Add Column and values in columns in dataset
Only one row of my dataset is being written and it is putting the price with the wrong item. What am I doing wrong?
In thesecond row appears but the price and total column values are not shown
Dim myCol As DataColumn
Dim myCol1 As DataColumn
Dim countme As Integer = 0
cols = dsreport.Tables(0).Columns
myCol = cols.Add("COST", System.Type.GetType("Syste m.String") )
myCol1 = cols.Add("TOTAL", System.Type.GetType("Syste m.String") )
countme = 0
For countme = 0 To dsreport.Tables(0).Rows.Co unt '- 1
dsreport.Tables(0).Rows(co untme).Ite m("TOTAL") = Format(dsreport.Tables(0). Rows(count me).Item(" TOTPRICE") , "$##.##0")
dsreport.Tables(0).Rows(co untme).Ite m("COST") = Format(dsreport.Tables(0). Rows(count me).Item(" PRICE"), "$##.##0")
Next
dsreport.Tables(0).Columns .Remove("T OTPRICE")
dsreport.Tables(0).Columns .Remove("P RICE")
In thesecond row appears but the price and total column values are not shown
Dim myCol As DataColumn
Dim myCol1 As DataColumn
Dim countme As Integer = 0
cols = dsreport.Tables(0).Columns
myCol = cols.Add("COST", System.Type.GetType("Syste
myCol1 = cols.Add("TOTAL", System.Type.GetType("Syste
countme = 0
For countme = 0 To dsreport.Tables(0).Rows.Co
dsreport.Tables(0).Rows(co
dsreport.Tables(0).Rows(co
Next
dsreport.Tables(0).Columns
dsreport.Tables(0).Columns
One question how is cols defined ?
ASKER
my bad........sorry
Dim cols As DataColumnCollection
Dim cols As DataColumnCollection
Strange, I used your code and I can't find anything wrong with it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am not doing a datasource for a datagrid. I am writing the dataset data to a document. I need to keep that dataset in tact.