Article View: borland.public.delphi.database.dotnet
Article #683Re: Why MySQL for .NET Transaction doesn't work ??
From: Stewart Basterash
Date: Sat, 23 Oct 2004 04:14
Date: Sat, 23 Oct 2004 04:14
36 lines
1968 bytes
1968 bytes
Should the query not look like
Insert into table (field1, field2) values (value1, value2)...
<ice@ice.com> wrote in message news:41539575$1@newsgroups.borland.com...
>I use the following code trying to insert two rows, it is supposed to
>commit
> all
> the changes only when the Commit() is called. However, I don't know why it
> will commit the change to table just after calling ExecuteNonQuery()
>
> is there anyone can help ? Thx a lot !
>
> tran:=con.BeginTransaction(IsolationLevel.ReadCommitted);
> try
> cmd:=con.CreateCommand; //dri.GetDBCommand;
> cmd.Connection:=con;
> cmd.Transaction:=tran;
>
> cmd.CommandText:='insert into abc values ("xa123")';
> cmd.ExecuteNonQuery;
> cmd.CommandText:='insert into abc values ("xa1234")';
> cmd.ExecuteNonQuery;
>
> tran.Commit;
> except
> tran.Rollback;
> end;
>
>
>
> ps: I'm using MYSQL 4
>
>
Technical Details
Message-ID:
<4179dbb1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41539575$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1effe6,b5cd2e3cca8da7f1 X-Google-Attributes: gid1effe6,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Stewart Basterash" <stewartbash@hotmail.com> Newsgroups: borland.public.delphi.database.dotnet References: <41539575$1@newsgroups.borland.com> Subject: Re: Why MySQL for .NET Transaction doesn't work ?? Date: Fri, 22 Oct 2004 23:14:37 -0500 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 65.42.181.33 Message-ID: <4179dbb1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1098505137 65.42.181.33 (22 Oct 2004 21:18:57 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!38.119.100.83.MISMATCH!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!in.nntp.be!caladan.arrakis.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail