Results 1 to 2 of 2

Thread: transactions

  1. #1
    rahul Guest

    Default transactions

    hello there can ne one help me with transactions. i want to use it but where do i find some good sites to learn it. please help me.<BR><BR>cheers rahul<BR><BR>thx in advance

  2. #2
    Joel M Guest

    Default RE: transactions

    well, I wont go into MTS transactions... but regular transactions are really easy. you would usually do a database action like this:<BR>-----------------------<BR>dim conn, rs<BR>"dsn=foo")<BR><BR>sql = "SELECT * FROM table"<BR><BR>set rs = conn.execute(sql)<BR>----------------------<BR><BR>to incorporate transactions you would simply add 2 lines at the begining and end:<BR>-----------------------<BR><BR>dim conn, rs<BR>"dsn=foo")<BR>conn.BeginTrans<BR>< BR>sql = "SELECT * FROM table"<BR><BR>set rs = conn.execute(sql)<BR><BR>conn.CommitTrans<BR>------------------<BR><BR>that way... if you have several calls to the database, if there&#039s an error they all wont happen... this also brings up another level of transactional security.... by using the on error catch, you have the ability to rollback a transaction:<BR>-------------<BR>on error goto hosed<BR><BR>&#039other code<BR><BR>hosed:<BR>conn.RollbackTrans<BR>respon se.write("you&#039&#039re hosed")<BR>--------------<BR>hope it helps<BR><BR>Joel M<BR>

Posting Permissions

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