|
dba is a custom class that handles database queries. The GetScalarFromDB(string SQL) does Command.ExecuteScalar() and returns whatever comes back boxed as an object.
The weird thing is that the above code evaluates differently on 2 different PCs:
on my PC the results are as follows:
resObj = {1M} {decimal}
res = "1" {string}
tryParse = true;
count = 1 {int}
On my coworker's PC the results are (bold are the differences):
resObj = {1M} {decimal}
res = "1.0" {string}
tryParse = false;
count = 0 {int}
By examining the cause of tryParce failure I figured out that the exception is "Input string is not in a correct format"
I've been racking my brain trying to solve the reason for the difference and can't.
Does anyone have any clue as to why there is a difference?
PeterPosted Jul 28, 2009, 12:49 PM
Blocked AccountPosted Jul 28, 2009, 1:17 AM
This is happening due to this res = "1.0" {string} while converting.
because you are using int.TryParse so u have to pass the values like 1,2,123,10 etc in the res parameter.
I think u got it.