Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0why DNN doesnwhy DNN doesn't use application level Transactions?
Previous
 
Next
New Post
8/1/2007 9:59 AM
 

Can any one tell me why DNN is not using application level transactions?  (DBTransactions, TransactionScope)

I notice only SQLTransactions are passed on to methods and used only at store procedure levels.

I appreciate any response.

 
New Post
8/2/2007 3:11 PM
 

Similar problem here - I've been looking for documentation on SQLTransactions but can't find anything.

I've developed a few modules using the DAL+ method but the one thing missing is transactions. I could do this in the Stored Procedure but would rather do it in code if possible. Can someone direct me to some suitable documentation.

Thanks in advance

 
New Post
8/3/2007 2:58 PM
 

DaveCarson: If you install source code installation of DNN You will find SQLTransaction usage at SqlDataProvider.vb. 

DotNetNuke_04.05.03_Source\Library\Providers\DataProviders\SqlDataProvider\SqlDataProvider.vb(243):

Private

Sub ExecuteADOScript(ByVal trans As SqlTransaction, ByVal SQL As String)'Get the connection

 

 

Dim connection As SqlConnection = trans.Connection'Create a new command (with no timeout)

 

command.Transaction = trans

command.CommandTimeout = 0

command.ExecuteNonQuery()

 

 

  Overloads Overrides Function ExecuteScript(ByVal Script As String, ByVal UseTransactions As Boolean) As String

 

Dim SQL As String = ""

 

Dim Exceptions As String = ""

 

 

 

Dim Delimiter As String = "GO" & ControlChars.CrLfDim arrSQL As String() = Split(Script, Delimiter, , CompareMethod.Text)If UseTransactions Then

 

Conn.Open()

 

Dim Conn As New SqlConnection(UpgradeConnectionString)Try

 

 

Dim Trans As SqlTransaction = Conn.BeginTransactionDim IgnoreErrors As Boolean

 

 

For Each SQL In arrSQLIf Trim(SQL) <> "" Then

 

' script dynamic substitution

SQL = SQL.Replace(

SQL = SQL.Replace(

IgnoreErrors =

"{databaseOwner}", DatabaseOwner)"{objectQualifier}", ObjectQualifier)False

 

If SQL.Trim.StartsWith("{IgnoreError}") Then

IgnoreErrors =

True

SQL = SQL.Replace(

 

"{IgnoreError}", "")End If

 

Try

ExecuteADOScript(Trans, SQL)

 

 

Catch objException As SqlExceptionIf Not IgnoreErrors Then

Exceptions += objException.ToString & vbCrLf & vbCrLf & SQL & vbCrLf & vbCrLf

 

End If

 

End Try

 

End If

 

Next

 

If Exceptions.Length = 0 Then

 

'No exceptions so go ahead and commit

Trans.Commit()

 

Else

 

'Found exceptions, so rollback db

Trans.Rollback()

Exceptions +=

 

"SQL Execution failed. Database was rolled back" & vbCrLf & vbCrLf & SQL & vbCrLf & vbCrLfEnd If

 

Finally

Conn.Close()

 

End Try

 

Public

Dim command As New SqlCommand(SQL, trans.Connection)End Sub 

 

 
New Post
8/4/2007 1:38 PM
 

Thanks for the feedback - I'll see what I can cobble together.

Cheers

 
New Post
8/5/2007 10:22 AM
 

I see that the method to execute transactions is declared private. There may be a public method available that accesses it but I don't think there is.

If you need transactions you should use a stored procedure. You can still use the DAL+ because these methods are available:

 

  • ExecuteNonQuery - Used to execute a stored procedure that will not return a value.
  • ExecuteReader - Used to execute a stored procedure that will return multiple records.
  • ExecuteScalar - Used to execute a stored procedure that will return a single value.
  • ExecuteSQL - Used to execute a sql statement. 

     

    see: http://www.adefwebserver.com/DotNetNukeHELP/DNN_Things4Sale/ThingsForSale2.htm


  • Michael Washington
    http://ADefWebserver.com
    www.ADefHelpDesk.com
    A Free Open Source DotNetNuke Help Desk Module
     
    Previous
     
    Next
    HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0why DNN doesnwhy DNN doesn't use application level Transactions?


    These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

    For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

    1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
    2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
    3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
    4. No Flaming or Trolling.
    5. No Profanity, Racism, or Prejudice.
    6. Site Moderators have the final word on approving / removing a thread or post or comment.
    7. English language posting only, please.
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out
    What is Liquid Content?
    Find Out