Exemple #1
0
 public override object?ConvertTo(ITypeDescriptorContext?context, CultureInfo?culture, object?value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw ADP.ArgumentNull("destinationType");
     }
     if ((destinationType == typeof(string)) && (value != null) && (value is int))
     {
         return(ODB.ELookup((OleDbHResult)value));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
        private void FillCloseError(COMException e, Exception f)
        {
#if DEBUG
            if (AdapterSwitches.DataError.TraceError)
            {
                Debug.WriteLine(e.ToString() + " " + ODB.ELookup(e.ErrorCode));
            }
#endif
            if (ODB.ADODB_AlreadyClosedError != e.ErrorCode)
            {
                throw f;
            }
        }
Exemple #3
0
        internal static OleDbHResult GetErrorDescription(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult hresult, out string message)
        {
            OleDbHResult hr = errorInfo.GetDescription(out message);

            if (((int)hr < 0) && ADP.IsEmpty(message))
            {
                message = FailedGetDescription(hr) + Environment.NewLine + ODB.ELookup(hresult);
            }
            if (ADP.IsEmpty(message))
            {
                message = ODB.ELookup(hresult);
            }
            return(hr);
        }
Exemple #4
0
        internal static OleDbException NoErrorInformation(string provider, OleDbHResult hr, Exception inner)
        {
            OleDbException e;

            if (!ADP.IsEmpty(provider))
            {
                e = new OleDbException(SR.Format(SR.OleDb_NoErrorInformation2, provider, ODB.ELookup(hr)), hr, inner);
            }
            else
            {
                e = new OleDbException(SR.Format(SR.OleDb_NoErrorInformation, ODB.ELookup(hr)), hr, inner);
            }
            ADP.TraceExceptionAsReturnValue(e);
            return(e);
        }
        private void FillNextResultError(COMException e, Exception f)
        {
#if DEBUG
            if (AdapterSwitches.DataError.TraceError)
            {
                Debug.WriteLine(e.ToString() + " " + ODB.ELookup(e.ErrorCode));
            }
#endif
            // i.e. ADODB.Recordset opened with adCmdTableDirect
            // Current provider does not support returning multiple recordsets from a single execution.
            if (ODB.ADODB_NextResultError != e.ErrorCode)
            {
                throw f;
            }
        }
Exemple #6
0
        static internal OleDbHResult GetErrorDescription(UnsafeNativeMethods.IErrorInfo errorInfo, OleDbHResult hresult, out string message)
        {
            Bid.Trace("<oledb.IErrorInfo.GetDescription|API|OS>\n");
            OleDbHResult hr = errorInfo.GetDescription(out message);

            Bid.Trace("<oledb.IErrorInfo.GetDescription|API|OS|RET> %08X{HRESULT}, Message='%ls'\n", hr, message);
            if (((int)hr < 0) && ADP.IsEmpty(message))
            {
                message = FailedGetDescription(hr) + Environment.NewLine + ODB.ELookup(hresult);
            }
            if (ADP.IsEmpty(message))
            {
                message = ODB.ELookup(hresult);
            }
            return(hr);
        }
Exemple #7
0
 internal static string FailedGetSource(OleDbHResult errorcode)
 {
     return(SR.Format(SR.OleDb_FailedGetSource, ODB.ELookup(errorcode)));
 }
Exemple #8
0
 internal static string FailedGetDescription(OleDbHResult errorcode)
 {
     return(SR.Format(SR.OleDb_FailedGetDescription, ODB.ELookup(errorcode)));
 }
Exemple #9
0
 internal static string NoErrorMessage(OleDbHResult errorcode)
 {
     return(SR.Format(SR.OleDb_NoErrorMessage, ODB.ELookup(errorcode)));
 }
Exemple #10
0
 static internal string FailedGetSource(OleDbHResult errorcode)
 {
     return(Res.GetString(Res.OleDb_FailedGetSource, ODB.ELookup(errorcode)));
 }
Exemple #11
0
 static internal string FailedGetDescription(OleDbHResult errorcode)
 {
     return(Res.GetString(Res.OleDb_FailedGetDescription, ODB.ELookup(errorcode)));
 }
Exemple #12
0
 static internal string NoErrorMessage(OleDbHResult errorcode)
 {
     return(Res.GetString(Res.OleDb_NoErrorMessage, ODB.ELookup(errorcode)));
 }