Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Unanswered: (Problem) Insert data error by VB6 with DB2 V7

    I am using Win 2k, VB 6.0 with service pack 5, DB2 V7.1

    I have the following program


    ---------------------------------------------------
    Dim conInsert As ADODB.Connection
    Dim cmdChange As ADODB.Command

    Set conInsert = New ADODB.Connection
    conInsert.Mode = adModeReadWrite

    conInsert.Open "a vilid connect string"

    Set cmdChange = New ADODB.Command
    Set cmdChange.ActiveConnection = conInsert

    cmdChange.CommandType = adCmdText

    cmdChange.CommandText = "INSERT INTO STD_NEW_RECORD (
    STD_ID, STD_NAME, STD_CLASS.....
    SELECT
    STD_ID, OLD_STD_NAME..
    FROM OLD_STD_RECORD WHERE
    STD_ID like '000%'" <= problem is here

    cmdChange.Execute
    -------------------------------------------------

    The above statements insert the old student record table into a new student record table. STD_ID is char(12) and the primary key of both table

    I use the "STD_ID like '000%'" to limit the number of record insert into the new student table. By change the condition, i can roughly limit the number of record insert into the new student table

    When the the number of record is about 8000, the program run correctly, but when I delete condition "STD_ID like '000%'", about 100000 record will insert into the new student record table, the VB program crash.

    the message just said some memory location is not allow to read.

    Would anyone help me solve this problem?

    THANKS

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322

    Re: (Problem) Insert data error by VB6 with DB2 V7

    Sounds like your just timing out..

    Why not make this a stored procedure and call that...

    It'll be compiled, and run more effeciently (well as effecient a scan is going to be)...

    Really code of your logic as sprocs and leave the presentation to vb...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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