本文整理汇总了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;
}
示例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;
}