Ads 468x60px

Monday, January 28, 2013

XAF : Execute SQL Procedure within Controller

Simply you can access session object via current user object, then you'll have full access to all functions in this object. To do this:
  1. Dim session As Session = CType(SecuritySystem.CurrentUser, User).Session
  2. session.ExecuteSproc("YourSqlProcedure").
another example:
  1. Dim paramsOperand As New List(Of OperandValue)
  2. Dim session As Session = CType(SecuritySystem.CurrentUser, User).Session
  3. Dim curUserOid As Guid = CType(SecuritySystem.CurrentUser, User).Oid
  4. paramsOperand.AddRange(New OperandValue() {curUserOid})
  5. session.ExecuteSproc("TransferThisPeriodBills", paramsOperand.ToArray)