Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fichiers
Recherche: 

Transactions made easy
Denny Jacob
A helper class for transaction enabled data write. It can be used as is, on backend databases which support transactions e.g. SQL server, Oracle and yes Access too. .
Créé le
Il y a 12 années
Téléchargements
1022
Type de fichier
Freeware
General information
Résultat de votes:
Description
A helper class for transaction enabled data write.

Methods:

  • SetParameterValue - method supplies values to parameters in a sql query
  • ExecuteNonQuery - for use w/ SQLs that need to return the number of rows affected e.g. INSERT ...
  • ExecuteScalar - returns a value from a query SELECT COUNT(*) ...
  • ExecuteSql - for use w/ SQLs that return a DataTable
  • Commit() - Attempts to write everything from the transaction scope
  • Rollback() - Prevents everything in the transaction scope from being written to the underlying tables
  • IsCommitted- Property indicates save status:
    • True - indicates a successful commit operation.
    • False - indicates transaction roll back or uncommitted transactions.
Sample usage in the code:
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim shipperNames As String() = {"First Shipping Company", "Second Shipping Company", "Third Shipping Company", Nothing}

        Using rs As New Framework_Code.TxnWrite("NorthwindConnectionString")
            Try
                For i As Byte = 0 To 3 ' Change this to 2 for a successful commit because CompanyName cannot be NULL/Nothing.
                    rs.SetParameterValue("CompanyName", shipperNames(i))
                    rs.ExecuteNonQuery("INSERT INTO Shippers (CompanyName) VALUES (@CompanyName)")
                Next
                rs.Commit()
            Catch ex As Exception
                rs.Rollback()
            End Try
            Label1.Text = IIf(rs.IsCommitted, "Committed", "Rolledback")
        End Using

    End Sub
Créé par
Denny Jacob
UT brotherhood is a great place to turn to when you are in dire need of a programming clue. It is been my experience that at least 3 people respond to each problem I post. "Downloads" has a wealth of great VCXs and ideas to equip a good VFP programmer for better. God bless UT.

Commentaires
Ajouter un commentaire
More downloads created from this member
Denny Jacob
This is a class to send emails with minimum effort while allowing for multiple To, Cc, Bcc and Attachments. You will need to also modify your web.config to work with your SMTP provider i.e. the settings you would use on your Outlook Account settings.
Créé le
Il y a 17 années
Téléchargements
1143
Type de fichier
Freeware
Résultat de votes
4.00/5.00