Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataTable.WriteXML() method
Message
De
15/03/2013 09:38:27
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01568459
Message ID:
01568497
Vues:
31
>>>Hi everybody,
>>>
>>>I've written some relatively simple method and found that C# execution is about 10 times slower than VFP implementation of the same
>>>
>>>200 ms. vs. 30 ms.
>>>
>>>So, I've been trying to somehow optimize that. Part of the method is to return XML string. I've been experimenting with
>>>
>>>dataTable.WriteXML method and unfortunately it does 2 things which I do not need:
>>>
>>>1. It inserts < NewDataSet > as the root node - why, I am not asking for dataset.GetXML() so why would it create this artificial node anyway?
>>>
>>>2. It puts carriage return \r\n after each element which I do not need either.
>>>
>>>So, I can go back to manual generation of the string I need or do you think that I should still go with either GetXML or WriteXML - I do not see any difference between them if dataset has one table and do 3 replaces to get rid of \r\n and NewDataSet tag?
>>>
>>>UPDATE. I figured why I was getting that big difference - I was running VFP against local SQL Server while C# against remote database. But after I made the necessary change, VFP is still slightly faster.
>>
>>And the VFP version could also handle any table structure ?
>
>Yes. At least the ones we use. I went with the string builder solution for generating the XML we need. Right now my C# method performs slightly worse than VFP and that upsets me. I looked at the code if there is an opportunity to optimize but don't see much.

If you're just using DataTable.WriteXML() and a Replace there's not much to optimize :-}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform