Hello
I am getting this error:
-2147467259
Microsoft OLE DB Provider for SQL Server
Cannot create new connection because in manual or distributed transaction mode.
When executing this classic ASP code:
On Error Resume Next
objConn.BeginTrans
objConn.Execute "EXEC sp_Name ...", , adCmdText + adExecuteNoRecords
objConn.Execute "UPDATE table_name ... ", , adCmdText + adExecuteNoRecords
If Err Then
objConn.RollbackTrans
WriteError Err.Number & " " & Err.Source & " - " & Err.Description
Else
objConn.CommitTrans
End If
On Error Goto 0
I have read the MS article specifically for this issue,
SQLOLEDB Allows Only One Connection in Scope of Transaction, but it references statements that are returning recordsets using a forward only cursor.
My stored procedure is doing one INSERT to a table with no triggers or anything and the second command is a simple update, again to a table with no triggers or similar.
In both cases I have specified the execute enum of adExecuteNoRecords, so it should know there is no rowset coming back anyway. The stored procedure starts with "set nocount on", which I know has caused some issues with ADO in the past.
I understand SQL server maybe creating an implicit connection somewhere, but goodness knows why. I don't need MARS for this, surely?
Can anyone help me understand why these insert and update commands are falling over each other and raising this error?
Connection String:
Provider=SQLOLEDB.1;Password=password;Persist Security Info=True;User ID=user_id;Initial Catalog=db_name;Data Source=server_ip;Network Library=DBMSSOCN;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=HVAW23;Use Encryption
for Data=False;Tag with column collation when possible=False;User Id=user_id;PASSWORD=password;
Thanks and regards
David