I'm running into a bit of a wall here and googling isn't helping so far.
I'm trying to get a value from a dataset table using the current row and the current column.
Basically I have a loop for each row, then one for each column and at some point I want to get the value:
For each objRow as datarow in .rows
...do some stuff
For each objCol as datacolumn in .colums
...do some other stuff
strArray(intIndex) = (the value in the current column of the current row)
I've tried using something like this:
strArray(intIndex) = CType(objRow.Item(objCol.ColumnName.ToString), String)
after dealing with many exceptions..but this isn't working. It gives me an error:
"Cast type from DBNull to type String is not valid"
The problem is that MANY of the fields in the datasets can be null.
I'm putting them into a string array so that I can add them to a different table later (after doing some operations on the array..its not a straight 1 to 1 add...basically I am concatenating data from 2 tables into one row and adding a couple of fields)
Can anyone give me a hint?
0 · ·