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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Numeric Issue

Numeric Issue

Scheduled Pinned Locked Moved Database
delphidatabasehelpquestion
4 Posts 3 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.
  • D Offline
    D Offline
    Darkness84
    wrote on last edited by
    #1

    I have a column in my database called SaleNumber which has a datatype numeric(18,0). One of the values I have stored in there is 11101930593 however when I retrieve this value from the database in my delphi application the number displayed is -1782971295. Does anybody know what could possibly be going on here?

    C 1 Reply Last reply
    0
    • D Darkness84

      I have a column in my database called SaleNumber which has a datatype numeric(18,0). One of the values I have stored in there is 11101930593 however when I retrieve this value from the database in my delphi application the number displayed is -1782971295. Does anybody know what could possibly be going on here?

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      I don't know Delphi so this could be way off the mark. I'm guessing that it might be an overflow. Are you putting the column value in a 32bit integer? A 32bit integer has a range of rougly -2billion to +2billion. Your number is roughly 11 billion.


      Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        I don't know Delphi so this could be way off the mark. I'm guessing that it might be an overflow. Are you putting the column value in a 32bit integer? A 32bit integer has a range of rougly -2billion to +2billion. Your number is roughly 11 billion.


        Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos

        D Offline
        D Offline
        Darkness84
        wrote on last edited by
        #3

        No I am parsing it in as an unsigned long.

        D 1 Reply Last reply
        0
        • D Darkness84

          No I am parsing it in as an unsigned long.

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

          It looks like Colin is right. You tried, somewhere along the line, to stuff a 64-bit number into a signed 32-bit variable. What you're seeing is a sure sign of an overflowed signed 32-bit value. Step through your code and verify that the value you got from the database is what you expect, the instant you get that value. Then follow it from there. Perhaps the value IS an unsigned 64-bit value, but when you went to display it, it got truncated to a signed 32-bits.

          Dave Kreskowiak Microsoft MVP - Visual Basic

          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