Transactions

The .NET Framework provides an integration between XML Web services and Microsoft DTC distributed transactions. You can cause a method that is exposed using the WebMethod attribute to start a DTC transaction using the Transaction property of the WebMethod attribute.

					[WebMethod(TransactionOption=TransactionOption.Required)] public DataSet GetBookByTitle(string title) { DataSet ds; SqlCommand cmd; SqlDataAdapter dsCmd; SqlParameter param; SqlConnection conn; ds=new DataSet(); conn=new SqlConnection( "user id=sa;password=;initial catalog=DevDotNet;data source=localhost"); cmd=new SqlCommand("GetBooksByTitle",conn); cmd.CommandType=CommandType.StoredProcedure; param=cmd.Parameters.Add(new SqlParameter("@Title",SqlDbType.NVarChar,255)); ...

Get .NET and COM Interoperability Handbook, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.