Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Trouble saving GPS coordinates to database

  • 29-12-2006 10:03PM
    #1
    Registered Users, Registered Users 2 Posts: 872 ✭✭✭


    Hi,

    Im trying to save latitude and longtiude coordinates from a google map into a database.

    The value is coming from a textbox so when im saving it im doing:

    Convert.ToDecimal(txtLat.Text)

    It's getting saved into a column that is a decimal(18,0) data type in a SQL Server DB.

    Trouble is when it saves the value it saves it as .6 instead of .6546787544

    Any ideas ?

    thanks


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Well looks like either your ConvertoDecimal function is rounding the fraction to the closest place or it is SQL doing it as default.
    I'm sure if you look into google more we'll be able to help or if you post the function here


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    http://msdn2.microsoft.com/en-us/library/ms187746.aspx

    you need to specify the number of decimal places
    decimal(18,2) should allow 2.45 (no sql server on hand to test)
    if I was testing this I would first verify that if I did a direct insert into the db that the decimal column would save the required number and then test the convert function


Advertisement