Results 1 to 6 of 6

Thread: Overflow error

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    8

    Overflow error

    I am reading a TBD(To be determined) table from SQL server. My code works for records 1- 32766, then starting at record 32767, I get an overflow error at here:
    intTBDID = recTBD("TBD_ID").
    intTBDID is declared as integer, and TBD_ID in the SQL table is integer.
    I understand it is the value greater than what TBDID can have. but it is an integer, and 32767 is not that huge number. Where should I look for the cause?
    I am using VB6, and slq 2000.
    Any help is great! Thank you.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    32766 is the limit for and Integer. Go with a Long instead, it can hold upwards of 2 billion+.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Re: Overflow error

    Originally posted by zzz8611
    it is an integer, and 32767 is not that huge number
    I don't know what you mean, that it's not that huge number. It is the max value for an integer in VB (although a SQL integer will hold a value up to 2,147,483,647)!

    You need to use a VB datatype that supports a larger number, such as a long.
    ~seaweed

  4. #4
    Fanatic Member
    Join Date
    Feb 2003
    Location
    Los Angeles, CA
    Posts
    681
    our sweet vb uses 2 bytes to represent variables declared as Integer, so the max positive value is 32767. sql server uses 4 bytes to represent what it calls an 'int' variable, so the max positive value in there is 2smth bilions. what that means is that vb and sql have different opinions about what an 'integer' is. to correct this, use long variables in your vb application to host integer datat types in sql.
    there are 2 reasons why i leave my work unfinished:
    (1) i'm getting old.

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    8

    overflow error, thanks.

    I thought VB is the same as sql. Now it works! Thanks again.

  6. #6
    Fanatic Member
    Join Date
    Feb 2003
    Location
    Los Angeles, CA
    Posts
    681
    ntz. vb is like noooo-thing else.
    there are 2 reasons why i leave my work unfinished:
    (1) i'm getting old.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width