Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the field name and the field value of a row
Message
De
13/01/2007 09:52:50
 
 
À
13/01/2007 04:04:37
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01185330
Message ID:
01185361
Vues:
17
>In my case, I have a dataset, which I extract the row from, but I do not have the datatable to collect that information from.

Ah, but you do ... if the DataRow came from a table to begin with, then it has a table property that tells you what that table was. You can then do this:
string ColumnName;
object ColumnValue;
for (int i=0; i < MyRow.Table.Columns.Count; i++)
{
    ColumnName  = MyRow.Table.Columns[i].ColumnName;
    ColumnValue = MyRow[i];
    // -or- ColumnValue = MyRow[ColumnName]; -- either way --
}
~~Bonnie




>>Ok...well, if you found a way, that's all that matters.
>>
>>If you're working with typed datasets, especially built from a schema that was generated from the database, you'd have similar information.
>>
>>I realize your information is coming from a database, I was just using a datatable with different columns as an example.
>
>Yes, as this is a two step process, requiring a datatable to exist, this is why I switched to my own approach.
>
>In my case, I have a dataset, which I extract the row from, but I do not have the datatable to collect that information from.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform