.Net, ADO.NET, ASP.NET, Database, DB Connection Example, Error Handling, SQL, SQL Server 2005, SQL Server 2008, SQL Tips, Transact-SQL, tSQL, Web Development, XML

Correcting: SELECT failed because the following SET options have incorrect settings: ‘ARITHABORT’

This error showed up on a stored procedure that I was trying to execute from an ASP.NET Web page. The strange part was that I could execute the stored procedure directly from SSMS without any problems.

The procedure was very simple in its design, but the database I was working in was new to me and I had very limited access. The procedure was set up to receive an XML parameter and then to do a bulk insert into a table from the XML. Continue reading “Correcting: SELECT failed because the following SET options have incorrect settings: ‘ARITHABORT’”

Advertisements
.Net, ADO.NET, ASP.NET, Error Handling, Programming, SQL, XML

InvalidCastException – Failed to convert parameter value from a XmlDocument to a String

InvalidCastException
InvalidCastException was unhandled by user code

If you are working with XML data types in your .NET and SQL Server code, then you will most likely encounter this error message at some point.

Specifically, this error is related to improperly passing an XML value as a SQLParameter to your database.

Since most of the work one does with XML in .NET is done using the XmlDocument object, it is certainly surprising when Visual Studio complains when one tries to save the XML object as an XmlDocument to the database (say to a stored procedure or directly to a database table).

The bottom line is that you must adjust your  XmlDocument object  to a format compatible with the SqlDbType.XML accepted by your SqlParameters.

There are a few ways that you can use to pass your XML object to your database:

Continue reading “InvalidCastException – Failed to convert parameter value from a XmlDocument to a String”

.Net, ADO.NET, ASP.NET, Data Sources, Error Handling, Programming

ASP.NET Error – Adding the specified count to the semaphore would cause it to exceed its maximum count

If you are working with ASP.NET in Visual Studio, then you may be mystified when you see an error code : Adding the specified count to the semaphore would cause it to exceed its maximum count.

This error had me wondering what exactly is going on… Continue reading “ASP.NET Error – Adding the specified count to the semaphore would cause it to exceed its maximum count”