SQL Server Autocommit - SqlSetParameter always returns FALSE

General discussion forum about all databases other than SqlBase.
Christoph
Germany
Posts: 11
Joined: 13 May 2019, 11:33
Location: Germany

SQL Server Autocommit - SqlSetParameter always returns FALSE

Post by Christoph » 22 Sep 2015, 08:57

Hello Guptas,
1.
when I use SqlSetSessionParameter or SqlSetParameter to set autocommit to on, both functions always return FALSE. But they do what I would expect.
When I set autocommit off, both function work like expected and they return TRUE.

2.
SQLFreeSession always commits uncommited transactions instead of rolling them back.

3.
Is it new, that the default behaviour on SQL Server is autocommit off?

German windows 7, Team Developer 6.2 SP 4, SQL Server 2012

Regards
Christoph Spangehl

Code: Select all

Set sUDL = "Provider=SQLNCLI11.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=yourserver"
If SqlCreateSession( hSession, sUDL )
   If SqlSetSessionParameter( hSession, DBP_AUTOCOMMIT, FALSE, STRING_Null )
      ! works
      Call SalMessageBox( 'ok', '', MB_Ok )
   If SqlSetSessionParameter( hSession, DBP_AUTOCOMMIT, TRUE, STRING_Null )
      ! never comes here, but works
      Call SalMessageBox( 'never seen', '', MB_Ok )
   Set bOk = TRUE
   If SqlCreateStatement( hSession, hSql )
      If SqlSetParameter( hSql, DBP_AUTOCOMMIT, FALSE, STRING_Null )
         ! same thing
         Call SalMessageBox( 'ok', '', MB_Ok )
      If SqlSetParameter( hSql, DBP_AUTOCOMMIT, TRUE, STRING_Null )
         ! same thing
         Call SalMessageBox( 'never seen', '', MB_Ok )
      Call SqlDisconnect( hSql )
   Call SqlFreeSession( hSession )

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests