dotConnect for SQL Server Documentation
Devart.Common Namespace / QueryRecordCountException Class
Members Example

In This Topic
    QueryRecordCountException Class
    In This Topic
    Describes an error that is raised during record count request process.
    Syntax
    'Declaration
     
    Public Class QueryRecordCountException 
       Inherits System.Exception
       Implements System.Runtime.InteropServices._ExceptionSystem.Runtime.Serialization.ISerializable 
    Remarks
    This class is used to differentiate exceptions from DbDataTable.QueryRecordCount and other fetch exceptions. The actual error message can be accessed via the System.Exception.InnerException property.
    Example
    The sample shows a catch block that is defined to catch a QueryRecordCountException exception.
    // Create a command selecting all records from the Dept table.
    Devart.Data.SqlServer.SqlCommand command = new Devart.Data.SqlServer.SqlCommand("select * from Dept");
    try
    {
        // Execution of the command will fail as no connection is set to it.
        command.GetRecordCount();
    }
    catch (QueryRecordCountException ex)
    {
        // Use the InnerException property to determine the actual error occurred.
        Console.WriteLine("An error occurred while counting records in the result set: " 
            + ex.InnerException.Message);
    }
    ' Create a command selecting all records from the Dept table.
    Dim command = New Devart.Data.SqlServer.SqlCommand("select * from Dept")
    Try
        ' Execution of the command will fail as no connection is set to it.
        command.GetRecordCount()
    Catch ex As QueryRecordCountException
        ' Use the InnerException property to determine the actual error occurred.
        Console.WriteLine("An error occurred while counting records in the result set: " _
            + ex.InnerException.Message)
    End Try
    Inheritance Hierarchy

    System.Object
       System.Exception
          Devart.Common.QueryRecordCountException

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also