parse a string of ID's from database to new columns in datagridview

cwfontan

Active member
Joined
Jan 9, 2009
Messages
35
Programming Experience
1-3
is there a way to parse a string of ID's seperated by "-" and get the description for each id and return in a new column?

<?????>
select* into datatable

for each row
array() = split(movesequence, "-")
i = array.count
from 0 to i
new column = array(i)
column Name = "location" & i.tostring
i = i+1
next

</?????>


VB.NET:
table1
id  |  depotID  |  custID  |  moveSequence  
1      586           203        224-1481-224 
2      586           203        224-1685-224
3      586           198        224-1481-386-224
4      586           789        224-369-898-224


table2
id   |  description
224      myAddress224
369      myAddress369
386      myAddress386
898      myAddress898
1481     myAddress1481
1685     myAddress1685


datagridview display

id  |  depotID  |  custID  |  moveSequence      |  loc1       |     loc2       |     loc3        |        loc4
1      586           203        224-1481-224       myAddress224     myAddress1481     myAddress224
2      586           203        224-1685-224       myAddress224     myAddress1685     myAddress224
3      586           198        224-1481-386-224   myAddress224     myAddress1481     myAddress386   myAddress224
 
Back
Top