Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Data Row column values and string values
Message
 
 
À
09/07/2013 17:52:19
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
Application:
Web
Divers
Thread ID:
01578028
Message ID:
01578032
Vues:
40
>The best thing you could do would be to change the rowValues to use a KeyValuePair of string, object instead. Then the types wouldn't need to be converted. Of course that may not be possible depending on where that came from. Keep in mind you may need to use the Equals method to compare objects.
>
>If it isn't possible to change the type of rowValues, you could get the type from the column from bookingRow.Table.Columns[kvp.Key]. Use the column's type to try to convert your kvp.Value using either Convert.ChangeType (http://msdn.microsoft.com/en-us/library/dtb69x08%28v=vs.100%29.aspx), or writing your own conversion method to parse, cast, or convert as appropriate.

Funny, but I'm back to the problem I found at first. My rowValue right now is " " and the passed value is "" and they compare as different, but I'd like to compare them as the same.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform