c# - FormatException exception in DbGeography when changing region -


Text after "

What's the simple one?

This code runs in Australia (where it was written), it works.

  public static void CreatePointTest () {double latitude = -33.613869; Double Lawn = 153.123456; Var text = string.Format ("POINT ({0} {1})", loan, lat); // 4326 is the most common co-ordination system, which is GPS / Maps var expansion on line = DB oophyli Used by the phraseframe text (text, 4326); }  

When I change the "French (France)" area code on my computer and run it, I get an exception on the return statement which is related to the number format:

  System.Reflection.TargetInvocationException was thrown by the target without action _HResult = -2146232828 _message = exception target of an invocation. HResult = -2146232828 IsTransient = false Message = Exception is thrown from the target of an invention. Source = mscorlib StackTrace: System.RuntimeMethodHandle.InvokeMethod (object object, object [] logic, signature sig, boolean producer) [Erosion ...] InnerException: System.FormatException _HResult = -2146233033 _message = 24141: Expected on a number The input's position is in 16 input, 613869 HResult = -2146233033 IsTransient = false message = 24141: Expected a number on the position of input 16. In input, 613869 source = Microsoft SQL Server. Type StackTrace: On Microsoft SQL Server. Type. Wizard reader reader Repeat SQL () in Microsoft SQL Microsoft SQL Server on. Percepoint Text (Boolean PerPonentials) in Microsoft. SQLServer Type.wakkentown text reader (OpenGIS Type Type) Microsoft.SqlServer.Types.WellKnownTextReader.Microsoft.SqlServer.Types.SqlGeography.ParseText (OpenGisType type, SqlChars taggedText, Int32 srid) on Microsoft.SqlServer.Types.SqlGeography.GeographyFromText (OpenGisType type, Int32 Srid read (OpenGisType type, SqlChars taggedText, Int32 SRID) on Microsoft.SqlServer.Types.SqlGeography.STPointFromText (SqlChars pointTaggedText, Int32 SRID) InnerException:  

Change your line

  text = String.Format ("point {{}} {1}", longitude, Latitude); By  

string , Lat);

In French, , is used as a decimal operator instead of . .


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -