Differences in SQL 2000

  • Hey all,

    I have the below code in a VB6 project (this is part of a function, frm is a form name)

    frm.AdodcTemp.Recordset.Delete adAffectCurrent

    It runs fine on one DB (cant get it to error) - but on another it fails on request (i can get it to fail every time).  Here is the error.

    Run time error 3021

    Either EOF or BOF is true, or the current recordset has been deleted. Requested operation requires a current record

    Both servers are running Windows 2000 SP4.  Both running SQL 2000 SP4 (checked all the versions, as per M$ - all identical).  Used Component checker - both running same MDAC, all MDAC dlls are same version.  Every time i have tried this i am connection via Vb6 IDE from my PC - just connecting to different servers.

    Anyone got any ideas what else could cause this in SQL?

    Dan

     

  • this will be data related....

    on db1, the recordset frm.AdodcTemp.Recordset was loaded with a select statement...

    but on db2, the same select statment returned no data, so the recordset is at the beginning of file or End of file (BOF or EOF)

    you should be checking for that condition prior to deleting, or even better, disable the delete functionality if the condition below is true

    If Not (frm.AdodcTemp.Recordset.BOF AND frm.AdodcTemp.Recordset.EOF) Then

      frm.AdodcTemp.Recordset.Delete adAfectCurrent

    End If

    a lame example would be in db1, select * from sometable where somevalue=34 returns a value, but in db2, the table [sometable] has no rows of data at all.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks....

    But the data is indenticle in both grids (both DBs).

    I am 99.99999% sure that its not the data thats the problem.

  • Sorry - and to confirm.

    The datagrid is bound to a table.  There is a routine which calculates values - and sticks them in this table/grid.

    If the routine is run a second time, the above code triggers (and for one DB, falls over) - so it deletes the initial row.

    So just to clarify its not the data thats the problem.

  • All,

    Just to confirm (as the same thing is has been asked on other forums i have posted on (not SQLsc)).

    I have taken a backup from our main DB this morning (which works) and moved it (data and all (227meg)) to the test DB (which doesnt work).

    Logged onto the test database - still doesnt work!

    Any other ideas?

    Dan

  • Have you checked the .DLL versions of the grid - we had a similar problem with True DBGrid?

    Brent

  • Brent,

    Not really applicable i think - as i am running the code on the same PC, so the same Dll.

    Dan

Viewing 7 posts - 1 through 6 (of 6 total)

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