Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copying data into an existing datarow
Message
 
À
03/04/2007 09:45:07
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01211623
Message ID:
01211652
Vues:
13
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform