This project has moved. For the latest updates, please go here.

Arithmetic overflow error converting numeric to data type numeric

Apr 27, 2011 at 3:30 PM

Hi,
When I try to update a device in the openPDC Manager I get the following error:

"Arithmetic overflow error converting numeric to data type numeric."

Then, when I change my regional settings to English (United States) I am able to update the device.

But I get the following message in the openPDCConsole:

[SEL-751A] Defaulting to UTC. Failed to find system time zone for ID "Hora oficial do Brasil": The time zone ID 'Hora oficial do Brasil' was not found on the local computer.

 

Regards,

Hugo.

 

Coordinator
Apr 29, 2011 at 8:55 PM

We haven't done much testing on non-English platforms, however, we try to fix these kinds of issues as they are reported, so I'll copy this to a work item.

Perhaps at some point we can recruit some volunteers to help provide some system level translations for the product...

Thanks!
Ritchie

Coordinator
Apr 29, 2011 at 8:55 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 4, 2011 at 3:02 PM

Hi Ritchie,

Regarding the TimeZone error, I think I have a solution.

I think this issue could be fixed with the following change: instead of using the StandardTime to create the dictionary, it should use the ID.

 

openPDCManager.Data.CommonFunctions

public static Dictionary<string, string> GetTimeZones(bool isOptional)
{
   Dictionary<string, string> timeZonesList = new Dictionary<string, string>();
   if (isOptional)
      timeZonesList.Add("", "Select Timezone");

   foreach (TimeZoneInfo tzi in TimeZoneInfo.GetSystemTimeZones())
   {
      if (!timeZonesList.ContainsKey(tzi.StandardName))
         timeZonesList.Add(tzi.Id, tzi.DisplayName);
         //timeZonesList.Add(tzi.StandardName, tzi.DisplayName);

      System.Diagnostics.Debug.WriteLine(tzi.DisplayName);
   }
   return timeZonesList;
}

 

The error occurs because int the TVA.PhasorProtocols.PhasorMeasurementMapper.Initialize() the StandardTime (that was being stored in the database) is used to retrieve the TimeZoneInfo by FindSystemTimeZoneById:

 

if (settings.TryGetValue("timeZone", out setting) && !string.IsNullOrWhiteSpace(setting) && string.Compare(setting.Trim(), "UTC", true) != 0 && string.Compare(setting.Trim(), "Coordinated Universal Time", true) != 0)
{
   try
   {
      m_timezone = TimeZoneInfo.FindSystemTimeZoneById(setting);
   }
   catch (Exception ex)
   {
      OnProcessException(new InvalidOperationException(string.Format("Defaulting to UTC. Failed to find system time zone for ID \"{0}\": {1}", setting, ex.Message), ex));
      m_timezone = TimeZoneInfo.Utc;
   }
}

 

And depending on the display language of Windows, the StandardTime and ID could be different. Causing the error. 

 

Regards, 

Hugo Machado.

Coordinator
May 5, 2011 at 4:00 PM

Thanks Hugo! We'll try out your patch!

Ritchie