System.Data.SqlClient.SNINativeMethodWrapper.SNIGetLastError C# (CSharp) Method

SNIGetLastError() private method

private SNIGetLastError ( SNI_Error &pErrorStruct ) : void
pErrorStruct SNI_Error
return void
        internal static extern void SNIGetLastError(out SNI_Error pErrorStruct);

Usage Example

Ejemplo n.º 1
0
        private SNIErrorDetails GetSniErrorDetails()
        {
            SNIErrorDetails details = new SNIErrorDetails();

            if (TdsParserStateObjectFactory.UseManagedSNI)
            {
                SNIError sniError = SNIProxy.Singleton.GetLastError();
                details.sniErrorNumber = sniError.sniError;
                details.errorMessage   = sniError.errorMessage;
                details.nativeError    = sniError.nativeError;
                details.provider       = (int)sniError.provider;
                details.lineNumber     = sniError.lineNumber;
                details.function       = sniError.function;
                details.exception      = sniError.exception;
            }
            else
            {
                SNINativeMethodWrapper.SNI_Error sniError;
                SNINativeMethodWrapper.SNIGetLastError(out sniError);
                details.sniErrorNumber = sniError.sniError;
                details.errorMessage   = sniError.errorMessage;
                details.nativeError    = sniError.nativeError;
                details.provider       = (int)sniError.provider;
                details.lineNumber     = sniError.lineNumber;
                details.function       = sniError.function;
            }
            return(details);
        }