X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 926FB476076 for ; Tue, 25 Feb 2003 01:17:07 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 95846-09 for ; Tue, 25 Feb 2003 01:16:38 -0500 (EST) Received: from smtp.netease.com (unknown [202.108.36.216]) by postgresql.org (Postfix) with ESMTP id 28F8447606D for ; Mon, 24 Feb 2003 21:32:56 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by smtp.netease.com (Postfix) with SMTP id 8D6F91C25CD09 for ; Tue, 25 Feb 2003 10:32:37 +0800 (CST) Received: from zengjun (unknown [218.108.223.252]) by 192.168.1.216 (Coremail) with SMTP id jAEAAMXVWj6+Gt/8.1 for ; Tue, 25 Feb 2003 10:32:37 +0800 (CST) From: "=?GB2312?Q?=D4=F8=BE=FC?=" To: pgsql-odbc@postgresql.org Subject: Transaction is affected by a recordset X-mailer: Foxmail 4.2 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Feb 2003 10:30:41 +0800 Message-Id: <20030225023237.8D6F91C25CD09@smtp.netease.com> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200303/2 X-Sequence-Number: 2721 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 execut= e "delete ..." first , and then open a recordset. At the end ,I commit the = transaction . But , delete is no effect . When I instead the parameter "adL= ockOptimistic" with "adLockReadOnly" . the delete runs successful. Why ? I notice that if I use parameter "adLockOptimistic" and the "sql" sele= cts from two table or selects from a view , con.Execute "delete from xsf= pex " 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 =3D adUseClient con.Execute "delete from xsfpex " Dim sql As String sql =3D "select a.tablename from wise_table a, wise_table b where = a.isleaf=3D1 and a.type_=3D3 and a.ptableid=3Db.id and b.tablename=3D'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 =3D Nothing con.CommitTrans =20=09=09=09=09 '------------------------------------------------ =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1junzeng@netease.com =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A12003-02-25