Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transaction
Message
From
07/08/2003 01:50:43
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Transaction
Miscellaneous
Thread ID:
00817569
Message ID:
00817569
Views:
60
I am creating a MultiTier application , I created a abstract form in a dll, I referenced the dll in my project , I want to handle a transaction whithin the abstract form , while my dataadaptors are in another dll.
What is the best approach?

I have done this code but I am getting this error on the call to commit the transaction
"Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."


Mycode is as follows:
1- AbstractForm Code
'''retrieve button
Dim tr As IDbTransaction
tr = BeginTransaction(m_Connection)
dim dt as datatable
getData(dt)
grdData.datasource=dt
'''Save button
SaveData(dt)
tr=CommitTransaction(m_Connection, tr) ' error comes here

2- EmployeeForm which inherits from AbstractForm
Sub MustOverrides getData(dt as datatable)
RetrieveEmployee(dt)
End Sub
Sub MustOverrides SaveData(dt as datatable)
SaveEmployee(dt)
End Sub

3- DataAccessLayerCode
Sub RetrieveEmployee(ByVal dt As dsEmployees.EmployeesDataTable)
daEmployee.Fill(dt)
End Sub

Sub SaveEmployee(ByVal dt As dsEmployees.EmployeesDataTable)
daEmployee.Update(dt)
End Sub

4- General Dll Code
Public Shared Function BeginTransaction(ByRef rcon As IDbConnection) As IDbTransaction
Dim il As IsolationLevel = IsolationLevel.RepeatableRead
If rcon.State = ConnectionState.Closed Then
rcon.Open()
End If
Return CType(rcon.BeginTransaction(il), IDbTransaction)
End Function

Public Shared Function BeginTransaction(ByRef rcon As IDbConnection,_
ByVal il As IsolationLevel) As IDbTransaction
If rcon.State = ConnectionState.Closed Then
rcon.Open()
End If
Return CType(rcon.BeginTransaction(il), IDbTransaction)
End Function
System Analyst
Nabil B. Ghrayyeb
nabilg@hotmail.com
Next
Reply
Map
View

Click here to load this message in the networking platform