Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing Data Row column values and string values
Message
De
10/07/2013 11:56:38
 
 
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:
01578115
Vues:
41
>>>
>>>foreach (KeyValuePair<String, String> kvp in rowValues)
>>>         {
>>>            String passedValue = kvp.Value.Trim();          //  I would not Trim() here.  Make sure the are Trimmed before they go in the dictionary
>>>            string rowValue = bookingRow[kvp.Key].ToString().Trim();
>>
>>>            if ( passedValue != rowValue ) 
>>>            {
>>>   >                  this.SaveToBookingHistory(booking_id, "M", kvp.Key, rowValue , passedValue, ref messageText, ref statusCode);
>>>            }
>>>         }
>
>I think they actually trimmed in the method that populates dictionary, I'll double check.
>
>That was my original attempt but it doesn't work as rowValue will be 0 (in case of numeric) and my string value will be empty. This is why I started the whole business of attempting to convert to the proper type.

It's really simple - use the same method as they used to do the conversion. Then you won't have any problem here
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform