Databases Reference
In-Depth Information
AdomdUnknownResponseException
AdomdUnknownResponseException is thrown when ADOMD.NET parses the response sent
by the server. This can happen if the request has been sent to an XML/A provider with a
version of XML/A that is not supported by the client. Often, such errors are fatal; the
client application should not continue to execute, but should instead notify the user.
AdomdConnectionException
AdomdConnectionException is thrown when the connection with the server cannot be
opened or has been interrupted. A good example of the use of this type of exception is if
the connection to the server fails, the client application can display a user interface in
which the user can specify missing connection information, such as the server name, user
ID, and password. AdomdConnectionException has the ExceptionCause property, which
provides information to the client application about the cause of the failure. In this
version of ADMOMD.NET, the ExceptionCause property can return two values:
AuthenticationFailed and Unspecified . Those properties provide a client application
with the information that the connection cannot be established because of security issues
or for some other reason.
AdomdCacheExpiredException
AdomdCacheExpiredException notifies the client application that the metadata cache has
expired. We talked about this type of exception earlier, in the section “Caching Metadata
on the Client” (see Listing 33.31).
LISTING 33.31
Catching Exceptions Thrown by ADOMD.NET
AdomdConnection con = new AdomdConnection(“Datasource=localhost;
Initial Catalog=foodmart 2008;”);
try
{
//Open a connection to the server.
con.Open();
//Do some operations.
//...
}
catch(AdomdConnectionException conException)
{
Console.WriteLine(conException.Message);
}
catch(AdomdErrorResponseException errorException)
{
//If there was an error, iterate the error collection and print the
//error message
foreach (AdomdError cellError in errorException.Errors)
Search WWH ::




Custom Search