Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2004
    Posts
    5

    Unanswered: VB6-SQL Runtime Error 6: Overflow

    Hi,

    I am currently do an application to access my company's database through SQL Server. The application is supposed to do the extraction of data from the text files and enter them into the database. Each file contains some 35k lines of data. Somehow, once I have 30+k lines in the database, I will run into runtime error 6: overflow. Any advice?

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    That could happen for several reasons which depends on how you are importing your data into SQL. You could be filling the SQL TempDB etc.. Could you post the VB code that you are using to try to find a solution.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    It looks like you are probably using an integer (16 bit) counter rather than a long (32 bit) counter somewhere in your code. The other thing to keep in mind is that VB defaults to an integer expression when evaluating integer-type data unless it is specifically cast into longs during the expression.

    Code:
    Dim L as Long
    a = 20000
    b = 20000
    c = 2
    L = (a + b) / c
    would overflow, for instance, even though the final result is 20000, and therefore within the limits of the integer datatype, as the intermediate calculation would overflow the integer.

    However,
    Code:
    Dim L as Long
    a = 20000
    b = 20000
    c = 2
    L = (cLng(a) + b) / c
    would not, nor would
    Code:
    Dim L as Long
    Dim a as Long
    a = 20000
    b = 20000
    c = 2
    L = (a + b) / c
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  4. #4
    Join Date
    Jul 2004
    Posts
    5
    Here's my code for the application. Hope it can help you guys help me. I only got Integer variables in my application and they are mostly counters.

    SourceCode

  5. #5
    Join Date
    Jul 2004
    Posts
    5
    By the way, I have no problem adding 2+k records to the database. I think the problem surface when I try to add more than 30k records. I don't remember the exact number of records when the problem occurs. It will take hours to add that much data for my application. Thanks in advance!

  6. #6
    Join Date
    Jul 2004
    Posts
    5
    Hmmm... Seems like I managed to solve this little problem. I noticed that the error surfaced right after 32767 records so I predicted that it's a Data Type problem as loquin suggested. I checked through my codes and find that I have 2 Integer variables that should be Long. Fixed that problem and thanks for the advice.

Posting Permissions

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