Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying data into an existing datarow
Message
 
To
03/04/2007 09:45:07
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01211623
Message ID:
01211652
Views:
12
>Paul... you said Cursor, do you mean datatable?

Yeah, both of them are datatable (I was justing using two different terms to help differenciate between them in my post).

I think I've got this resolved, but if there is a built-in way I'd love to hear it. I'm essentially just iterating through the columns of the SQL DataTable and grabbing the column name, then checking to see if there is a matching column in my XML DataTable. If there is, I copy the value over.

I'm also not entirely sure why SetModified() is required - I would have expected this to get set as soon as I modified the value.
drMatch[0].SetModified();
   
foreach (DataColumn column in dtPortal.Columns)
{
    DataColumn xmlColumn = dt.Columns[column.ColumnName];
    if (xmlColumn != null)
    {                                        
        drMatch[0][column.Ordinal] = row[xmlColumn.Ordinal];                                                                    
    }
}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform