Link to home
Start Free TrialLog in
Avatar of jimr111998
jimr111998

asked on

SQL 2005 Error Transaction Not initialized message

Hello,
I have vb.net web application which uses a SQL  database on a SQL 2005 server.
In my development environment. All works fine. When I move it to the web sever I get the
following  SQL error:
--------------------------------------------------------------------------------------------
ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized
-----------------------------------------------------------------------------------------------------
The code is essentially the following
'***************************************************

Private connectStringSQL = "Data Source=tcp:someserver; Initial Catalog=specificDB;User Id=userId;Password=DBPasswd;Connect Timeout=15;"
Private sqlConn 

Public Sub OpenConnection()
   sqlConn = New SqlConnection(connectStringSQL)
End Sub

Sub DoSQLcommand(sqlStatement)
  Trans = sqlConn.BeginTransaction()
  Using AsqlCommand As New SqlCommand(sqlStatement, sqlConn)

     Try
        AsqlCommand.Transaction = Trans
        AsqlCommand.ExecuteNonQuery()
     Catch sqex As SqlException
          RecordSQLerror(sqex)
     end Try
   End Using
  Trans.Commit
End Sub
'****at run time *****
OpenConnection()
'
'  ****  some things are done 
'
'
sqlStatement = ........   'whatever needed
 DoSQLcommand(sqlStatement)
'
'
 '**************************************************

Open in new window


Again this work fine in the development environment but not on the web server.

Any help will be appreciated
Thanks in advance..







Avatar of TempDBA
TempDBA
Flag of India image

This looks like IIS related issue, an insufficient right to the application pool. Try below:-

Identify the identity of the application pool
Ensure the app pool idenity has a sql user assigned for the organization database
Grant the app pool identity the right db_owner on the organization database
Restart IIS
Avatar of jimr111998
jimr111998

ASKER

TempDBA,

I am on a shared server and have no control of the IIS,  I have contacted their support with your
response and I'll see what they have to say.  If they provide a solution I give you the points.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of jimr111998
jimr111998

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
no other response helped but this is the answer that fixed the problem.