Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing Data Row column values and string values
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Comparing Data Row column values and string values
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01578028
Message ID:
01578028
Views:
54
Hi everybody,

I have the following code
foreach (KeyValuePair<String, String> kvp in rowValues)
         {
            String passedValue = kvp.Value.Trim();
            String rowValue = bookingRow[kvp.Key].ToString().Trim();
            if (passedValue != rowValue)
            {
               this.SaveToBookingHistory(booking_id, "M", kvp.Key, rowValue, passedValue, ref messageText, ref statusCode);
            }
         }
The problem here is that, for example, we're not passing default values, say, for Integer column the passed value will be empty string and 0 in the row value. It should be treated the same, but it doesn't.

I am wondering how to properly write the code above. I need to somehow figure out the type of rowValue (which comes from the DataRow) and cast passedValue into that type.

Do you know what can I do here?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform