<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://techbank.jp/Community/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja-JP"><title type="html">坊やがゆくtech</title><subtitle type="html" /><id>http://techbank.jp/Community/blogs/poohkid/atom.aspx</id><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/default.aspx" /><link rel="self" type="application/atom+xml" href="http://techbank.jp/Community/blogs/poohkid/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.20917.1142">Community Server</generator><updated>2009-11-11T00:01:00Z</updated><entry><title>トランザクションのネストと@@TRANCOUNTの関係、コミット／ロールバックについてまとめ</title><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/archive/2009/12/09/23075.aspx" /><id>http://techbank.jp/Community/blogs/poohkid/archive/2009/12/09/23075.aspx</id><published>2009-12-08T16:35:00Z</published><updated>2009-12-08T16:35:00Z</updated><content type="html">Microsoft TechNet「トランザクションのネスト」にて簡潔に説明されているので引用させていただきます。 @@TRANCOUNTのカウント（ざっくり） BEGIN TRANSACTION ステートメントは @@TRANCOUNT を 1 ずつ増やします。 COMMIT TRANSACTION は @@TRANCOUNT を 1 ずつ減らします。 ROLLBACK TRANSACTION ステートメントは、ネストしたトランザクションがすべてロールバックされ、@@TRANCOUNT は 0 になります。 @@TRANCOUNT が 0 の場合は、トランザクションにいません。 http://technet.microsoft.com/ja-jp/library/aa213076(SQL.80).aspx トランザクションの外側と内側の概念、超重要！ Microsoft SQL Server は、内部トランザクションのコミットを無視します。 トランザクションは、最も外側のトランザクションが終了したときの処理に基づいてコミットまたはロールバックされます。 外側のトランザクションがコミットされた場合...(&lt;a href="http://techbank.jp/Community/blogs/poohkid/archive/2009/12/09/23075.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://techbank.jp/Community/aggbug.aspx?PostID=23075" width="1" height="1"&gt;</content><author><name>PoohKid</name><uri>http://techbank.jp/Community/members/PoohKid.aspx</uri></author></entry><entry><title>クエリ・エディタでもトランザクションを使おう</title><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/17/22676.aspx" /><id>http://techbank.jp/Community/blogs/poohkid/archive/2009/11/17/22676.aspx</id><published>2009-11-16T15:30:00Z</published><updated>2009-11-16T15:30:00Z</updated><content type="html">SQL Server Management Studioのクエリ・エディタはちょっとしたSQLを試すのに便利ですね。 でも更新系のSQLをいきなり叩いて後悔したことありませんか？ クエリ・エディタではTransact-SQLコマンドを記述できるのでトランザクションを使わない手はありません♪ トランザクション開始(TRANでも可) BEGIN TRANSACTION ロールバック/コミット ROLLBACK TRANSACTION COMMIT TRANSACTION 現在の接続でアクティブなトランザクション数を返します SELECT @@TRANCOUNT クエリ・エディタは文字を選択すれば選択した範囲のみ実行するので予めコメントとして用意しておき必要に応じて選択して実行すると便利。 --トランザクション開始 --BEGIN TRANSACTION --ロールバック/コミット --ROLLBACK TRANSACTION --COMMIT TRANSACTION --現在の接続でアクティブなトランザクション数を返します --SELECT @@TRANCOUNT もしくは、こうしておけばうっかり全て実行してしまっても安心...(&lt;a href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/17/22676.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://techbank.jp/Community/aggbug.aspx?PostID=22676" width="1" height="1"&gt;</content><author><name>PoohKid</name><uri>http://techbank.jp/Community/members/PoohKid.aspx</uri></author></entry><entry><title>TransactionScope中に例外が発生したのにロールバックされない</title><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22591.aspx" /><id>http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22591.aspx</id><published>2009-11-13T17:05:00Z</published><updated>2009-11-13T17:05:00Z</updated><content type="html">using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SQLite; using System.Transactions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { using (SQLiteConnection cnn = new SQLiteConnection(&amp;quot;Data Source=:memory:&amp;quot;)) // SQLiteはデフォルトで自動コミットモード { cnn.Open(); // この時点でトランザクションスコープに含まれる必要がある using (TransactionScope tran = new TransactionScope()) { try { using (SQLiteCommand cmd = cnn.CreateCommand()) { cmd.CommandText...(&lt;a href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22591.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://techbank.jp/Community/aggbug.aspx?PostID=22591" width="1" height="1"&gt;</content><author><name>PoohKid</name><uri>http://techbank.jp/Community/members/PoohKid.aspx</uri></author></entry><entry><title>【.NET】ゼロから5分でつくれるデータベースプログラミング【SQLite】</title><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22590.aspx" /><id>http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22590.aspx</id><published>2009-11-13T16:40:00Z</published><updated>2009-11-13T16:40:00Z</updated><content type="html">※ただしVisualStudioはインストール済み ちょっとしたサンプルを作りたいときにデータベースエンジンを用意しないで済むので手軽です。 さらにオンメモリに展開するのでSQLiteファイルのパスを気にする必要もありません。 （その代わり揮発性ですが＾＾；） サンプル作成手順： System.Data.SQLite のサイトからインストーラをダウンロード インストール VisualStudioで新規コンソールアプリケーションを作成（デフォルトで可） インストール先のbinにあるdllを参照に追加 System.Transactionsを参照に追加 こんな感じで更新や参照を行えます。 using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SQLite; using System.Transactions; namespace ConsoleApplication1 { class Program { static void Main(string...(&lt;a href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/14/22590.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://techbank.jp/Community/aggbug.aspx?PostID=22590" width="1" height="1"&gt;</content><author><name>PoohKid</name><uri>http://techbank.jp/Community/members/PoohKid.aspx</uri></author></entry><entry><title>はじめまして</title><link rel="alternate" type="text/html" href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/11/22492.aspx" /><id>http://techbank.jp/Community/blogs/poohkid/archive/2009/11/11/22492.aspx</id><published>2009-11-10T15:01:00Z</published><updated>2009-11-10T15:01:00Z</updated><content type="html">縁あってこちらでブログを書くことになりましたPoohKidと申します。 けろ-みおさんご紹介いただきましてありがとうございます。 なんかハードル上がったようなｗ 正直なところ客観的に見て私のレベルは中の上（たぶん）。 スーパーなプログラマではありませんが現場ではそれなりに使えると言っていただけてるようです。 一言で表すなら 低いテンション、中ぐらいの能力。 ですので 過度な期待はしないでください。 内容は主に.NETの話題になる予定です。 フツーのプログラマが日々の疑問や悩みから得た物を普通に語れたらいいなと思います。 生暖かい目で見守っていただけたら幸いです♪...(&lt;a href="http://techbank.jp/Community/blogs/poohkid/archive/2009/11/11/22492.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://techbank.jp/Community/aggbug.aspx?PostID=22492" width="1" height="1"&gt;</content><author><name>PoohKid</name><uri>http://techbank.jp/Community/members/PoohKid.aspx</uri></author></entry></feed>