wwsql::Begintransaction

Begins a SQL transaction.

o.BeginTransaction(lcTransactionName)

Return Value

Sql Result Code

Parameters

lcTransactionName
Optional name of the transaction - allows to nest transactions and reference the nested transaction explicitly for rollback or commit operations.

Example

loSql = CREATEOBJECT("wwSql")
loSql.Connect("database=WebStore")

loSql.BeginTransaction("order")

IF loSql.ExecuteNonQuery("Insert into Orders ... ") == -1 OR ;
   loSql.ExecuteNonQUery("Update Customers ...") == -1
   loSql.Rollback("order")
   RETURN
ENDIF

loSql.Commit("order")

See also:

Class wwsql

© West Wind Technologies, 1996-2024 • Updated: 02/17/19
Comment or report problem with topic