Re:SQL server 2000 / S1010 function sequence error

  • SQL ODBC 2000.81.9042.00

    MSVC++ 6.0 CRecordsets

    tab1.open(CRecordset:dynaset, ...);

    while ( ! tab1.IsEOF() )

    {

    db.BeginTrans();

    tab2.AddNew();

    ...

    ...

    tab2.Update();

    tab2.Close();

    tab3.Addnew();

    ...

    ...

    tab3.Update();

    tab3.Close();

    db.CommitTrans();

    tab1.MoveNext(); ---> S1010 error

    }

    With MySQL the coding works fine.

    Do you have any hints?

    thanks.

  • Several things - all suggestions since I'm not really sure what the source of this error is -

    1) You may want to check both EOF & BOF.

    "Use EOF after using the MoveNext method to make sure you stay within the bounds of your underlying database as you move between records.

    When you create or open a Dynaset that consists of one or more records, the first record is the current record, so EOF is False. BOF and EOF are both True when there are no records in the Dynaset."

    2) Try using a .movefirst at the beginning so you're sure you're starting with the first row - and then use - " while ( ! tab1.IsEOF() )"

    3) Is at least one row being updated as it should - re. tab2 & tab3 ?!

    4) How many rows are being returned do you know ?! Not sure why you aren't using a stored procedure to do this for you ?! - that would really be the way to go (almost) always!

    5) I came across an interesting article (about .addnew()) that you'd find helpful - things NOT to do







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply