Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Trouble saving GPS coordinates to database

Options
  • 29-12-2006 10:03pm
    #1
    Registered Users 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 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 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