Wednesday, 15 January 2014

VB6 Error when calling SQL Server SP: "Operation is not allowed when the object is closed" -


I have an old VB6 application that was connected to the production base database. The database was recently migrated to SQL Server 2008 R2 and now I am processing an app to keep it up-and-running. The error I am getting is "Operation is not allowed " when the object is closed.

This is the structure of the code on VB6:

  New ADODB.Connection connString = as the string reticular conn as the dim dim connString in the form of slow SQL "Provider = SQLNCLI10.1; Integrated Security = SSPI; Security Info = False, Initial List = CatalogName; Data Source = Production_Server_Name, "SQL =" EXEC sp_name @ param1, @ param2, @ param3, @ param4 "ADODB.Command Cmd = conn.Open connString as Cmd New ADODB.Command set Cmd.ActiveConnection = Conn Cmd.CommandText = SQL Cmd.CommandType = adCmdText CMD. CommandsTimeAut = 300DDRsADDB Record Setset RS = New ADODB Richeset R. Open sql, cone - & gt; Code fails on this line !!! RS set = Cmd.Execute () If there is nothing, or IsNull, then set RS = nothing bla bla bla bla bla.  

stored procedure code :

  process sp_name (integer, as in @ param1), as integral to param2, as integer as param3, as @ param4 nvarchar (150)) Set NOCOUNT - All code goes here Returns  

Code structure notes :

  • @param 1, Ultimate 2 and Ultimate 1 Integer Definition The value @param 4 different string values ​​by commas
  • I already know Adiodibi declared objects on the same line and may be instances.
    • The SP works perfectly when only the reading database is executed with the database from SSMS.
    • SP uses variable tables (@VariableTables) for intermediate processing accessories.
    • VB6 code works when "sp_who" bult in SQL Server SP
    • calling VB6 code works when SQL variable
    • calls for full merit SP fail (Exec DB. dbo.sp_name) using
    • SP failure

    Any words really appreciated for the error of this topic And correct answers are accepted immediately.

You need to open it for the first time

P>

  Moderate ADODB.Recordset set = as new ADODB.Recordset conn.Open () & lt; -. This rs.Open SQL missing, angle set rs = Cmd.Execute ()  

No comments:

Post a Comment