Try this:

NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
String MPT11 = "";
...
MPT11 = (row["MPT11"].ToString() == "-777") ? "null" 
: row["MPT11"].ToString("N", nfi);
...
rowList.Add(... , MPT11, ...);


On Tuesday, March 5, 2013 5:38:15 PM UTC-5, Matevz Uros Pavlic wrote:
>
> Error, 
> operator '==' can not be applied to operadns of type 'object' and 'int'.
>
> But, as i understand, i did something similar to what you mean by :
>
>  foreach (DataRow row in dt.Rows)
>                 {
>                     //Converts your object into a DateTime (so that it's 
> properties can be accessed properly
>                     DateTime yourDate = Convert.ToDateTime(row["Datum"]);
>                     String lastCol = Convert.ToString(row["MPT32"]);
>                
>                     
>                     if (Convert.ToString(row["MPT11"]) == "-777") 
> {row["MPT11"] = DBNull.Value;}
>                     if (Convert.ToString(row["MPT12"]) == "-777") 
> {row["MPT12"] = DBNull.Value;}
>                     if (Convert.ToString(row["MPT2"])  == "-777") 
> {row["MPT2"]  = DBNull.Value;}
>                     if (Convert.ToString(row["MPT31"]) == "-777") 
> {row["MPT31"] = DBNull.Value;}
>                     if (lastCol == "-777") {lastCol = "null";}
>
>                     rowsList.Add("[new Date(" + yourDate.Year + ", " + 
> (yourDate.Month - 1) + ", " + yourDate.Day + ", " + yourDate.Hour + ", " + 
> yourDate.Minute + ", " + yourDate.Second + "), " 
>                     + row["MPT11"] + ", " 
>                     + row["MPT12"] + ", " 
>                     + row["MPT2"]  + ", " 
>                     + row["MPT31"] + ", "
>                     + lastCol + "]");
>                 }
> rows = String.Join(", ", rowsList);
>
> I just changed the last value (lazy) , and it works.
>
> Now i have that error from before, when using it like this i get commas 
> instead of dots in server render, when running the script from server.
> And java console says i have more than 5 columns....that's what i can't 
> fix (currently).
>
> Thanks for the help
>
>
>
> On Tuesday, 5 March 2013 23:02:23 UTC+1, asgallant wrote:
>>
>> What if you use intermediary variables to carry the data?
>>
>> String MPT11 = "";
>> ...
>> MPT11 = (row["MPT11"] == -777) ? "null" : row["MPT11"].ToString();
>> ...
>> rowList.Add(... , MPT11, ...);
>>
>> On Tuesday, March 5, 2013 2:59:34 PM UTC-5, Matevz Uros Pavlic wrote:
>>>
>>> I tried that before, but it doesn't work. I get this error :
>>> *
>>> *
>>> *
>>> *
>>> * *System.FormatException: Input string was not in a correct format.
>>>
>>> m
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to