Table.TestConnectivity Method

Tests to see if a connection to the database can be established with the current information, and if the report can access the database table.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration
Public Overrideable Function TestConnectivity () As Boolean
public virtual bool TestConnectivity ()

Return Value

True if the database session, log on, and location information is correct. False if the connection fails or an error occurs.

Example

This example sets the table data source, tests the connection to the new data source, and returns a table alias.

'Declaration

      Private Function SetTableDataSource(ByVal myTable As Table, ByVal newSource As Object)
        Dim aliasName As String = Nothing
        myTable.SetDataSource(newSource)
        If myTable.TestConnectivity = True Then
          aliasName = myTable.Name
        End If
        SetTableDataSource = aliasName
      End Function
      
      private string SetTableDataSource(Table table, object newSource)
      {
        string aliasName = null;
        table.SetDataSource(newSource);
        if (table.TestConnectivity())
        {
          aliasName = table.Name;
        }
        return aliasName;
      }
      

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

Table Class
Table Members
CrystalDecisions.CrystalReports.Engine Namespace