Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

coping column data from one column to another

Status
Not open for further replies.

mxo

Programmer
May 20, 2005
51
ZA
Hi All. ThatRickGuy I tried the code similar to yours but with no luck see my code below:

Dim dr As Datarow
Dim InvalidTable as DataTable
for each dr in InvalidTable.rows
if dr("msisdn") = dr('epx_msisdn") Then
dr("accountClone") = dr("epx_Account")
end if
Next dr

and im getting runtime error InvalidTable = Nothing
sorry to be bit dum.
 
This line of code

Dim InvalidTable as DataTable

creates a variable that can hold a DataTable. Next, you need to actually create a DataTable object and put it into that variable:

InvalidTable = New DataTable

Your next bit of code:

for each dr in InvalidTable.rows
if dr("msisdn") = dr('epx_msisdn") Then
dr("accountClone") = dr("epx_Account")
end if
Next dr

won't execute at all, because as it is now there are no DataRows in InvalidTable.

You need to actually fill InvalidTable with data in order to be able to loop through its DataRows collection.

Check out the following link for a decent overview of ADO .NET (which is what is used for data access in .NET):



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top