当前位置: 首页>>代码示例>>C#>>正文


C# OleDbConnection.OnInfoMessage方法代码示例

本文整理汇总了C#中System.Data.OleDb.OleDbConnection.OnInfoMessage方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbConnection.OnInfoMessage方法的具体用法?C# OleDbConnection.OnInfoMessage怎么用?C# OleDbConnection.OnInfoMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.OleDb.OleDbConnection的用法示例。


在下文中一共展示了OleDbConnection.OnInfoMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessResults

        static internal Exception ProcessResults(OleDbHResult hresult, OleDbConnection connection, object src) {
            if ((0 <= (int)hresult) && ((null == connection) || (null == connection.Events[EventInfoMessage]))) {
                SafeNativeMethods.Wrapper.ClearErrorInfo();
                return null;
            }

            // ErrorInfo object is to be checked regardless the hresult returned by the function called
            Exception e = null;
            UnsafeNativeMethods.IErrorInfo errorInfo = null;
            OleDbHResult hr = UnsafeNativeMethods.GetErrorInfo(0, out errorInfo);  // 0 - IErrorInfo exists, 1 - no IErrorInfo
            if ((OleDbHResult.S_OK == hr) && (null != errorInfo)) {
                if (hresult < 0) {
                    // 





                    e = OleDbException.CreateException(errorInfo, hresult, null);
                    //}

                    if (OleDbHResult.DB_E_OBJECTOPEN == hresult) {
                        e = ADP.OpenReaderExists(e);
                    }

                    ResetState(connection);
                }
                else if (null != connection) {
                    connection.OnInfoMessage(errorInfo, hresult);
                }
                else {
                    Bid.Trace("<oledb.OledbConnection|WARN|INFO> ErrorInfo available, but not connection %08X{HRESULT}\n", hresult);
                }
                Marshal.ReleaseComObject(errorInfo);
            }
            else if (0 < hresult) {
                // @devnote: OnInfoMessage with no ErrorInfo
                Bid.Trace("<oledb.OledbConnection|ERR|INFO> ErrorInfo not available %08X{HRESULT}\n", hresult);
            }
            else if ((int)hresult < 0) {
                e = ODB.NoErrorInformation((null != connection) ? connection.Provider : null, hresult, null); // OleDbException

                ResetState(connection);
            }
            if (null != e) {
                ADP.TraceExceptionAsReturnValue(e);
            }
            return e;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:49,代码来源:OleDbConnection.cs

示例2: ProcessResults

 internal static Exception ProcessResults(OleDbHResult hresult, OleDbConnection connection, object src)
 {
     if ((OleDbHResult.S_OK <= hresult) && ((connection == null) || (connection.Events[EventInfoMessage] == null)))
     {
         SafeNativeMethods.Wrapper.ClearErrorInfo();
         return null;
     }
     Exception e = null;
     System.Data.Common.UnsafeNativeMethods.IErrorInfo ppIErrorInfo = null;
     if ((System.Data.Common.UnsafeNativeMethods.GetErrorInfo(0, out ppIErrorInfo) == OleDbHResult.S_OK) && (ppIErrorInfo != null))
     {
         if (hresult < OleDbHResult.S_OK)
         {
             e = OleDbException.CreateException(ppIErrorInfo, hresult, null);
             if (OleDbHResult.DB_E_OBJECTOPEN == hresult)
             {
                 e = ADP.OpenReaderExists(e);
             }
             ResetState(connection);
         }
         else if (connection != null)
         {
             connection.OnInfoMessage(ppIErrorInfo, hresult);
         }
         else
         {
             Bid.Trace("<oledb.OledbConnection|WARN|INFO> ErrorInfo available, but not connection %08X{HRESULT}\n", hresult);
         }
         Marshal.ReleaseComObject(ppIErrorInfo);
     }
     else if (OleDbHResult.S_OK < hresult)
     {
         Bid.Trace("<oledb.OledbConnection|ERR|INFO> ErrorInfo not available %08X{HRESULT}\n", hresult);
     }
     else if (hresult < OleDbHResult.S_OK)
     {
         e = ODB.NoErrorInformation((connection != null) ? connection.Provider : null, hresult, null);
         ResetState(connection);
     }
     if (e != null)
     {
         ADP.TraceExceptionAsReturnValue(e);
     }
     return e;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:OleDbConnection.cs


注:本文中的System.Data.OleDb.OleDbConnection.OnInfoMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。