ADO Connection

  • Hi

    I'm trying to add a record to my DB (SQL 2000), using a screen which gets all the detail of an employee.  I use a begintran & rollbacktran statement, but when the details is going to update in my back end i'm getting the following error.

    "Transaction cannot start because more than one ODBC connection is in use"

    So i tried opening a dynamic connection(not sure i have named it like that:laugh for the record set.  The following is the code

    'rsInsertEmployee.Open SqlInsertEmployee, lConn,adoOpenDynamic,adoLockOptimistic

    'rsCheck.Open Sqlcheck,lConn,adoOpenDynamic,adoLockOptimistic

    But it is giving me an error,

    "Microsoft VBScript runtime (0x800A01F4)

    Variable is undefined: 'adoOpenDynamic'"

    Did u think i stopped there...no

    But tried the below option

    rsCheck.Open Sqlcheck, lConn, 2, 3

    rsCheck.Open SqlInsertEmployee,lConn,2,3

    ADODB.Recordset (0x800A0E79)

    Operation is not allowed when the object is open.

    Do let me know how do i go about on the same...(one info off the track, i don't know which combination the record got update once....Don't ask me how / which combo)

    Arun


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

  • Try adOpenDynamic,adLockOptimistic instead of adoOpenDynamic,adoLockOptimistic .

    Edit : Ok. Just thought the correct syntax didn't include the "o". (thought reinforced by the error message you were getting)

    Otherwise, I don't know about VBScript, but in VB6 you get the option to access databases through an ADODC too (the access you're trying looks like ADODB), where all you need is a connection string.

  • oh buddy Bob, forgot to tell u that tried that first, still getting the same error message...

    Arun


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

  • It has been a while since I`ve done ADO in VB but it sounds, from the second error message, like you are trying to Open a connection that is already open (the first error may also be a variation on this).

    Check the commands in which you instantiate the connection & resultset, I remember that it can get a bit confusing in that you can create and open a connection in one command, or create it in one command and then open it in another (it seems to be a Microsoft speciality to have 10 ways of doing any one thing, but only one of them is correct ).


    "Don`t try to engage my enthusiasm, I don`t have one."

    (Marvin)

  • I was using the begin tran for a select statement rather than the update statement, but fought tough to spot it out.  Modified...and used it at the right portion and it solved my problem.

    Thanks every1 for their feedback.

    Arun


    Kindest Regards,

    Arunkumar

    Reputation is what other people know about you. Honor is what you know about yourself."--

Viewing 5 posts - 1 through 4 (of 4 total)

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