Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. decimal value in .sdf database

decimal value in .sdf database

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelpquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ejaz_pk
    wrote on last edited by
    #1

    I am working on a pocket pc application by using vb.net 2005. I create one table called products and want to store the costprice in decimal in products table. E.g:- if I enter 50.5 for costprice and save it then it automatically changes to 51 which is creating problem for calculation. How I can store decimal value in the table? Anybody knows how I can solve this? Thanks in advance

    L D D I 4 Replies Last reply
    0
    • E ejaz_pk

      I am working on a pocket pc application by using vb.net 2005. I create one table called products and want to store the costprice in decimal in products table. E.g:- if I enter 50.5 for costprice and save it then it automatically changes to 51 which is creating problem for calculation. How I can store decimal value in the table? Anybody knows how I can solve this? Thanks in advance

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      ejaz_pk wrote:

      How I can store decimal value in the table?

      what table? a DataTable? a table in a database, if so which database? Google[^]'s first hit is MSDN[^]. :|

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


      1 Reply Last reply
      0
      • E ejaz_pk

        I am working on a pocket pc application by using vb.net 2005. I create one table called products and want to store the costprice in decimal in products table. E.g:- if I enter 50.5 for costprice and save it then it automatically changes to 51 which is creating problem for calculation. How I can store decimal value in the table? Anybody knows how I can solve this? Thanks in advance

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You may also want to post the code that stores the value. There is no automatic rounding or conversion unless the data types are incorrect.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008
        But no longer in 2009...

        1 Reply Last reply
        0
        • E ejaz_pk

          I am working on a pocket pc application by using vb.net 2005. I create one table called products and want to store the costprice in decimal in products table. E.g:- if I enter 50.5 for costprice and save it then it automatically changes to 51 which is creating problem for calculation. How I can store decimal value in the table? Anybody knows how I can solve this? Thanks in advance

          D Offline
          D Offline
          Dalek Dave
          wrote on last edited by
          #4

          Try setting the field type to be a DECIMAL. (If poss in whatever DB you are using.)

          ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave

          1 Reply Last reply
          0
          • E ejaz_pk

            I am working on a pocket pc application by using vb.net 2005. I create one table called products and want to store the costprice in decimal in products table. E.g:- if I enter 50.5 for costprice and save it then it automatically changes to 51 which is creating problem for calculation. How I can store decimal value in the table? Anybody knows how I can solve this? Thanks in advance

            I Offline
            I Offline
            i i i
            wrote on last edited by
            #5

            How are you passing the values to the Db ? if you are storing in some variable/Property then passing to the db then check the Data Type of the Variable/Property. Try to use Quick Watch, if its going ok from Front end then check the Datatype of your Back end(Db). That the field data type is Decimal (18,0), if so then make its Scale to a value greater then 0 i.e; decimal(18, 8)

            SOFTDEV If you have knowledge, let others light their candles at it. [ Let's work to help developers, not make them feel stupid ]

            E 1 Reply Last reply
            0
            • I i i i

              How are you passing the values to the Db ? if you are storing in some variable/Property then passing to the db then check the Data Type of the Variable/Property. Try to use Quick Watch, if its going ok from Front end then check the Datatype of your Back end(Db). That the field data type is Decimal (18,0), if so then make its Scale to a value greater then 0 i.e; decimal(18, 8)

              SOFTDEV If you have knowledge, let others light their candles at it. [ Let's work to help developers, not make them feel stupid ]

              E Offline
              E Offline
              ejaz_pk
              wrote on last edited by
              #6

              :thumbsup: Thanks for the help. As I mentioned that I am using .sdf (sqlserverce) database which used for pocket pc applications. Actually there was problem in the table structure of my database. I was using int type of field in the table. Now I have change that field type to float and its working fine. Thanks every body

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups