Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Return Code From SQL Executions

Discussion in 'Information Technology' started by EarlCPhillips, Jul 28, 2006.

  1. EarlCPhillips

    EarlCPhillips
    Expand Collapse
    Guest

    As a mainframer, I used the DB2 return code to determine whether a read, an
    update or an insert was successful, a duplicate, not found, etc. I am trying
    to find a usable return code from SQL Server accessed from VBA with SQL
    statements executed therein. I have searched books on SQL Server 7 and 2000
    in vain. Can anyone help?
    Earl Phillips
    Volunteer Programmer
    Harvesters Community Food Bank
    --
    Trying To Feed The Hungry
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Ontario Police Review Arrest Of Sikh Man Whose Turban Wasn't Returned - CTV News Breaking News Jul 16, 2016
    Movies Ashdoc's short movie review---Tanu weds Manu returns Theatre, Movies & Cinema Jun 6, 2015
    Zoroastrianism Parsis pray for return of the scavenger bird Interfaith Dialogues Aug 28, 2013
    Steve Jobs' Return to Apple Business, Lifestyle & Leisure Mar 28, 2013
    Opinion Campaign to reward homeless man who returned diamond engagement ring hits $175,000 - and that total Breaking News Mar 7, 2013

  3. RoyVidar

    RoyVidar
    Expand Collapse
    Guest

    "EarlCPhillips" <EarlCPhillips@discussions.microsoft.com> wrote in
    message <A86F3F2E-D8E8-42D6-BC6D-191BC22D8461@microsoft.com>:
    > As a mainframer, I used the DB2 return code to determine whether a
    > read, an update or an insert was successful, a duplicate, not found,
    > etc. I am trying to find a usable return code from SQL Server
    > accessed from VBA with SQL statements executed therein. I have
    > searched books on SQL Server 7 and 2000 in vain. Can anyone help?
    > Earl Phillips
    > Volunteer Programmer
    > Harvesters Community Food Bank


    It's a bit dependent on how you "fire off" your SQL. If you use stored
    procedures etc, you could use an output parameter - but then you'll
    need
    the ADO command object, i think.

    For "usual" execution, both the DAO and ADO .execute methods support
    "recordsaffected".

    dim db as dao.database
    set db=currentdb
    db.execute "<some sql>", dbfailonerror
    msgbox db.recordsaffected

    dim cn as adodb.connection
    dim lngRecAff as long
    set db=currentproject.connection
    cn.execute "<some sql>", lngRecAff, adCmdText + adExecuteNoRecords
    msgbox lngRecAff

    --
    Roy-Vidar
     

Share This Page