Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve the SQL Error Number from a SOAP Exception

Status
Not open for further replies.

ESquared

Programmer
Dec 23, 2003
6,129
US
I am using C# with framework 2.0, but I don't need working code, just some info about the SoapException object returned when using web services to run SSRS reports.

If the SQL Server creating the report encounters an error, I do get the exception and can see all sorts of information. However, if it is a SQL error from the SQL server for the datasource, it lacks the information I need to build sensible error handling on it. For example, consider the following XML SOAP exception I got (this is SoapException.Detail.InnerXml, with namespace and helplink info removed to make it halfway legible):

[tt]<ErrorCode>rsProcessingAborted</ErrorCode>
<HttpStatus>400</HttpStatus>
<Message>An error has occurred during report processing.</Message>
<ProductName>Microsoft SQL Server Reporting Services</ProductName>
<ProductVersion>9.00.3042.00</ProductVersion>
<ProductLocaleId>1033</ProductLocaleId>
<OperatingSystem>OsIndependent</OperatingSystem>
<CountryLocaleId>1033</CountryLocaleId>
<MoreInformation>
<Source>Microsoft.ReportingServices.ProcessingCore</Source>
<Message msrs:ErrorCode="rsProcessingAborted">An error has occurred during report processing.</Message>
<MoreInformation>
<Source>Microsoft.ReportingServices.ProcessingCore</Source>
<Message msrs:ErrorCode="rsErrorExecutingCommand">Query execution failed for data set '{DataSetName}'.</Message>
<MoreInformation>
<Source>.Net SqlClient Data Provider</Source>
<Message>The EXECUTE permission was denied on the object '{Stored Procedure Name}', database 'Test', schema 'dbo'.</Message>
</MoreInformation>
</MoreInformation>
</MoreInformation>
<Warnings />[/tt]

What I need instead of the full "denied on object ObjectName" message is a simple error number or identifier for "EXECUTE permission denied on object" no matter what the object is.

And for a deadlock error, I'd need the error code for deadlock, not the nearly useless message "Transaction (Process ID 74) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction." This will look like a new error message for each new process ID.

There has to be a better way than parsing strings to find out what the error is so I can take the correct action. (E.g., deadlock = try again. Something wrong with this report = keep trying the other reports. Something wrong with sql connection = stop all reports.)

So far in my exploration and searches, I haven't found what I need. Anyone have any ideas?

Note: I have turned on "remote error handling" or whatever it was.

Erik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top