Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
getting row item from dataset with current row and column
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 · ·