locked
what is difference between ado.net transaction and sqltransaction RRS feed

  • Question

  • User-1184016586 posted

    Hi,

    if any one have idea about Difference between sql transaction and ado.net transaction, please explain

    thanks in advance

    Tuesday, October 4, 2011 10:13 AM

Answers

  • User-2103114970 posted

    SQL Server level

    I normaly prefer SQL Server level transactions only when I need to update Multiple Tables, like I have a Master Table, and a Detail Table, I want to update both the Master and Detail tables. 

    First I need to insert one row to Master Table, then I need to get some other value from the inserted row, and need to update Detail table with the value.

    .Net Level

    And I used ADO.Net (.Net Level) transaction only for one project, it is an SQL 2008 project, there was some requirement like, I need to save some DOC files in Database, it is using a SQL 2008 feature, called FileStream. If enable FileStream it will create some shared folder on the server, and Saves all the file data into this Folder, which can only read by SQL Server. 

    And the code is like 

    1) Insert the Filename into a Table.

    2) Read the GET_FILESTREAM_TRANSACTION_CONTEXT

    3) Read the Physical File

    4) Write the Filecontents to SqlFileStream

    To get the GET_FILESTREAM_TRANSACTION_CONTEXT, we need to use the Transaction in .Net level. There is some alternatives also found for the implementation, but we stick to this one.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 4, 2011 10:21 AM

All replies

  • User-2103114970 posted

    SQL Server level

    I normaly prefer SQL Server level transactions only when I need to update Multiple Tables, like I have a Master Table, and a Detail Table, I want to update both the Master and Detail tables. 

    First I need to insert one row to Master Table, then I need to get some other value from the inserted row, and need to update Detail table with the value.

    .Net Level

    And I used ADO.Net (.Net Level) transaction only for one project, it is an SQL 2008 project, there was some requirement like, I need to save some DOC files in Database, it is using a SQL 2008 feature, called FileStream. If enable FileStream it will create some shared folder on the server, and Saves all the file data into this Folder, which can only read by SQL Server. 

    And the code is like 

    1) Insert the Filename into a Table.

    2) Read the GET_FILESTREAM_TRANSACTION_CONTEXT

    3) Read the Physical File

    4) Write the Filecontents to SqlFileStream

    To get the GET_FILESTREAM_TRANSACTION_CONTEXT, we need to use the Transaction in .Net level. There is some alternatives also found for the implementation, but we stick to this one.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 4, 2011 10:21 AM
  • User-625475160 posted

    hi,

    refer this link

    http://www.codeproject.com/KB/database/transactions.aspx

     

    Tuesday, October 4, 2011 10:25 AM