Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XML to datarow
Message
De
13/05/2013 13:56:55
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01573699
Message ID:
01573714
Vues:
32
>>>>>foreach (DataRow row in ds.Tables[0].Rows)
>>>>>{
>>>>> foreach (DataColumn column in ds.Tables[0].Columns)
>>>>> {
>>>>> Console.WriteLine (column.ColumnName + ": " + row[column.ColumnName].ToString());
>>>>> }
>>>>>}
>>>>
>>>>Don't think that will work if you want to add the row to an existing table since the Row generated from the XML would not be the same as the row created by DataTable.NewRow().
>>>
>>>Yes, I think I'll keep it as a separate new dataset.
>>
>>That sounds as if the dataset will only be held temporarily. If that is the case why don't you just use the XML directly for whatever it is you want to do.....
>
>
>This is VFP code I am working on right now
>
>
>scatter memvar memo blank
>      .GatherFrom("<ALIAS>B_SCHED</ALIAS>" + tcActionList)
>      .write_log('m.Booking_ID = ' + alltrim(str(m.booking_id,16))+;
>         ' m.Resource1='+m.resource1+' m.start_time='+transform(m.start_time)+;
>         ' m.end_time='+transform(m.end_time)+' m.layer='+transform(m.layer)+;
>         ' m.lessontype='+transform(m.lessontype)+' m.podbktype='+transform(m.podbktype),;
>         program(), '5')
>
>So, I would need the values in the row and to me it's easier to use them as datarow.
>
>Here is part of what I wrote so far:
>
>
>String cActionList = GetParameterString(parameters, "tcActionList");
>
>            DataSet rowData = new DataSet();
>
>            rowData.ReadXml(new XmlTextReader(new StringReader(String.Format("{0}{1}{/0}", "b_sched", cActionList))));
>
>            Boolean max4s_over = database.GetPreferenceBoolean("prefs_bk", "max4s_over");
>            DataRow  row = rowData.Tables[0].Rows[0];
>
>            Logging.LogFormat(5, "m.Booking_ID = {0} m.Resource1={1} m.start_time={2} m.end_time={3} m.layer={4} m.lessontype={5} m.podbktype={6}",
Sorry, still doesn't make sense to me. No idea what the VFP .GatherFrom() is and still don't know why you need a DataTable. What do you eventually want to do with the XML content ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform