C# と VB.NET の質問掲示板

わんくま同盟

ASP.NET、C++/CLI、Java 何でもどうぞ

C# と VB.NET の入門サイト


■88838 / )  ObjectDisposedExceptionの対策について
□投稿者/ fragile (1回)-(2018/10/03(Wed) 22:33:41)

分類:[VB.NET/VB2005 以降] 

vb.netでOdbcConnection及びOdbcCommandを使用して
SQLServer2016を操作するソフトを作成していたのですが、
テーブルのupdateを行うストアドプロシージャ実行時に以下のエラーが
稀に発生して失敗してしまい、対処方法分かれば教えていただきたい次第です。

環境は以下の通りとなります。
[PC]
Windows8.1(アクセス側)
SQL Server2012(DB側)

[開発言語]
vb 2012


2018-10-02 13:58:41,220 [5736] [ERROR] 20181002_135841_220 [Int32 intExecuteStoredProc(System.String, System.Data.ParameterDirection[], System.String[], System.Data.Odbc.OdbcType[], Int32[], System.Object[])] :System.ObjectDisposedException: セーフ ハンドルは閉じられています。
   場所 System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   場所 System.Data.Odbc.OdbcHandle..ctor(SQL_HANDLE handleType, OdbcHandle parentHandle)
   場所 System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
   場所 System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
   場所 System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   場所 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   場所 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   場所 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   場所 System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   場所 System.Data.Odbc.OdbcConnection.Open()
   場所 GUID_Ctrl.clsDBAccess.intExecuteStoredProc(String strProcName, ParameterDirection[] ParamDirection, String[] strParam, OdbcType[] typParamType, Int32[] intParamLen, Object[] objParamValue)
2018-10-02 13:58:41,236 [5736] [ERROR] 【Err-Date】
2018/10/02 13:58:41
【Err-Info】
System.Exception: System.ObjectDisposedException: セーフ ハンドルは閉じられています。
   場所 System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
   場所 System.Data.Odbc.OdbcHandle..ctor(SQL_HANDLE handleType, OdbcHandle parentHandle)
   場所 System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
   場所 System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
   場所 System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   場所 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   場所 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   場所 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   場所 System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   場所 System.Data.Odbc.OdbcConnection.Open()
   場所 GUID_Ctrl.clsDBAccess.intExecuteStoredProc(String strProcName, ParameterDirection[] ParamDirection, String[] strParam, OdbcType[] typParamType, Int32[] intParamLen, Object[] objParamValue)
   場所 GUID_Ctrl.clsDBAccess.intExecuteStoredProc(String strProcName, ParameterDirection[] ParamDirection, String[] strParam, OdbcType[] typParamType, Int32[] intParamLen, Object[] objParamValue)
   場所 GUID_Ctrl.GpubDBModule.sp_SetTcRireki(Char BothTypeNo, Int32 BothNo, DateTime StartTime, String HistoryState)



よろしくお願いします。

返信 編集キー/


管理者用

- Child Tree -