从 adsDataReader 获取异常

发布于 2024-09-14 09:47:02 字数 2346 浏览 4 评论 0原文

我收到以下异常。表中有两条记录且HasRows = true

Advantage.Data.Provider.AdsException was unhandled by user code
  Message="Error 5018:  The handle given was not recognized by Advantage. Verify specified handle is open/active.  The given handle is not recognized as a valid Advantage Client Engine handle."
  Source="Advantage.Data.Provider"
  Number=5018
  State=""
  StackTrace:
       at Advantage.Data.Provider.AdsException.CheckACE(UInt32 ulRet)
       at Advantage.Data.Provider.AdsDataReader.GetName(Int32 iCol)
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.SelectBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer)
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.AdapterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.OnGetReaderAtBodyContents()
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.AdapterMessage.OnGetReaderAtBodyContents()
       at System.ServiceModel.Channels.Message.GetReaderAtBodyContents()
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
  InnerException: 

I am getting the following exception. There are two records in the table and HasRows = true

Advantage.Data.Provider.AdsException was unhandled by user code
  Message="Error 5018:  The handle given was not recognized by Advantage. Verify specified handle is open/active.  The given handle is not recognized as a valid Advantage Client Engine handle."
  Source="Advantage.Data.Provider"
  Number=5018
  State=""
  StackTrace:
       at Advantage.Data.Provider.AdsException.CheckACE(UInt32 ulRet)
       at Advantage.Data.Provider.AdsDataReader.GetName(Int32 iCol)
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.SelectBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.WriteBodyContents(XmlDictionaryWriter writer)
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.AdapterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
       at System.ServiceModel.Channels.Message.OnGetReaderAtBodyContents()
       at Ceridian.Benefits.AdvantageDbAdapter.Utilities.AdapterMessage.OnGetReaderAtBodyContents()
       at System.ServiceModel.Channels.Message.GetReaderAtBodyContents()
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
       at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
  InnerException: 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁虫ゝ 2024-09-21 09:47:02

当获取阅读器和使用阅读器之间的底层连接关闭时,我通常会看到这种情况。如果您使用全局连接,请检查它是否在之前的某个地方被关闭。

例如,以下代码块将在“读取”时收到 5018 错误,因为连接已关闭。

        AdsConnection cn = new AdsConnection("data source=c:\\");
        cn.Open();
        AdsCommand cmd = cn.CreateCommand();
        cmd.CommandText = "EXECUTE PROCEDURE sp_mgGetInstallInfo()";
        AdsDataReader dr = cmd.ExecuteReader();
        cn.Close();
        dr.Read();

如果移动 cn.Close();读完后你不应该得到错误。

I have typically seen this when the underlying connection was closed in between getting the reader and using the reader. If you are using a global connection check that it didn't get closed somewhere earlier.

For example the following code block will receive the 5018 error on the "read" since the connection was already closed.

        AdsConnection cn = new AdsConnection("data source=c:\\");
        cn.Open();
        AdsCommand cmd = cn.CreateCommand();
        cmd.CommandText = "EXECUTE PROCEDURE sp_mgGetInstallInfo()";
        AdsDataReader dr = cmd.ExecuteReader();
        cn.Close();
        dr.Read();

If you move the cn.Close(); to after the read you should not get the error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文