URL: http://msdn.microsoft.com/ko-kr/library/system.data.oracleclient.oracletransaction.aspx
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
OracleCommand command = connection.CreateCommand();
OracleTransaction transaction;
// Start a local transaction
transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);
// Assign transaction object for a pending local transaction
command.Transaction = transaction;
try
{
command.CommandText =
"INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')";
command.ExecuteNonQuery();
command.CommandText =
"INSERT INTO Dept (DeptNo, Dname, Loc) values (60, 'ENGINEERING', 'KANSAS CITY')";
command.ExecuteNonQuery();
transaction.Commit();
Console.WriteLine("Both records are written to database.");
}
catch (Exception e)
{
transaction.Rollback();
Console.WriteLine(e.ToString());
Console.WriteLine("Neither record was written to database.");
}
}
'C#.NET' 카테고리의 다른 글
| 실버라이트 웹서버에서 작동안될때(MIME 형식 설정) (0) | 2009.11.30 |
|---|---|
| DIV 태그로 전체화면 채우기 (0) | 2009.11.30 |
| 실버라이트3 외부실행 만들기 (0) | 2009.11.30 |
| 클래스 라이브러리에서 web.config 접속정보 읽어오기 (0) | 2009.11.30 |
| BLOB 저장된 이미지 웹상에 출력하기 (0) | 2009.11.30 |
| JavaScript에서 관리 코드 호출 (0) | 2009.07.15 |
| [마스터페이지 , masterpage ] PreviousPage 마스터페이지 컨트롤러에 접근 (0) | 2009.05.20 |
| Creating a modular application using Prism V2 - Screencast 1/4 : Creating a shell and modules (0) | 2009.05.12 |
| Downloading Files with the WebRequest and WebResponse Classes (0) | 2009.05.01 |
| SyntaxHighlighter for Windows Live Writer (0) | 2009.04.30 |