pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 曾军 <junzeng@netease.com>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Transaction  is affected by a recordset
Date: Tue, 25 Feb 2003 10:30:41 +0800
Message-ID: <20030225023237.8D6F91C25CD09@smtp.netease.com> (raw)

	Sorry to my poor English.
	I'm a program using Visuual Basic. I write the following code , as you see, I want to delete some data in a transaction , in the transaction I execute "delete ..." first , and then open a recordset. At the end ,I commit the transaction . But , delete is no effect . When I instead the parameter "adLockOptimistic"  with "adLockReadOnly" . the  delete runs successful. Why ?

    I notice that if I use parameter "adLockOptimistic" and the "sql"  selects from two table or selects from a view  ,   con.Execute "delete from xsfpex "  runs with no effect .

	I also notice that if I change  rs.CursorLocation to adServerClient , the "delete" runs successful .



the source codes:
'------------------------------------------------
        con.BeginTrans

        Dim rs As New Recordset
        rs.CursorLocation = adUseClient
        con.Execute "delete from xsfpex "

        Dim sql As String
        sql = "select a.tablename from wise_table a, wise_table  b where a.isleaf=1 and a.type_=3  and a.ptableid=b.id and b.tablename='xsfp'"
          rs.open sql, con, adOpenStatic, adLockOptimistic, adCmdText


        rs.MoveFirst

        Do While Not rs.EOF
                Debug.Print rs.Fields(0).Value
                rs.MoveNext
        Loop

        rs.Close

        Set rs = Nothing

        con.CommitTrans

 				
'------------------------------------------------


        junzeng@netease.com
          2003-02-25





Message-ID: <20030225023237.8D6F91C25CD09@smtp.netease.com>
Permalink:  ../20030225023237.8D6F91C25CD09@smtp.netease.com/
Also on:    postgresql.org/message-id/20030225023237.8D6F91C25CD09@smtp.netease.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: junzeng@netease.com
  Subject: Re: Transaction  is affected by a recordset
  In-Reply-To: <20030225023237.8D6F91C25CD09@smtp.netease.com>
  References: <20030225023237.8D6F91C25CD09@smtp.netease.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox