Share via


DatabaseFieldDefinitions Class

Contains the DatabaseFieldDefinition objects for every database field in the report.

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

Syntax

'Declaration
Public MustInherit Class DatabaseFieldDefinitions
    Inherits FieldDefinitions
    Implements IDisposable, ICollection, IEnumerable, IEnumerator
public abstract class DatabaseFieldDefinitions : FieldDefinitions, IDisposable, ICollection, IEnumerable, IEnumerator

Remarks

Retrieve the DatabaseFieldDefinitions collection through the Fields property of the Table Object.

Example

This example searches the database field definition by partial name.

'Declaration

          Private Function GetDatabaseFieldDefinitionByPartialName(ByVal myReportDocument As ReportDocument, ByVal databaseName As String, ByVal partialFieldName As String) As DatabaseFieldDefinition
            GetDatabaseFieldDefinitionByPartialName = Nothing
            Dim myTable As Table = myReportDocument.Database.Tables.Item(databaseName)
            If Not myTable Is Nothing Then
              Dim myDatabaseFieldDefinitions As DatabaseFieldDefinitions = myTable.Fields
              Dim i As Integer
              For i = 0 To myDatabaseFieldDefinitions.Count
                Dim myDatabaseFieldDefinition As DatabaseFieldDefinition = myDatabaseFieldDefinitions.Item(i)
                If InStr(myDatabaseFieldDefinition.Name, partialFieldName) > 0 Then
                  GetDatabaseFieldDefinitionByPartialName = myDatabaseFieldDefinition
                  Exit Function
                End If
              Next
            End If
          End Function
          
          private DatabaseFieldDefinition GetDatabaseFieldDefinitionByPartialName(ReportDocument reportDocument, String databaseName, String partialFieldName)
          {
            Table table = reportDocument.Database.Tables[databaseName];
            if (table != null)
            {
              DatabaseFieldDefinitions databaseFieldDefinitions = table.Fields;
              for (int i=0; i<databaseFieldDefinitions.Count; i++)
              {
                DatabaseFieldDefinition databaseFieldDefinition = databaseFieldDefinitions[i];
                if (databaseFieldDefinition.Name.IndexOf(partialFieldName) >=0)
                {
                  return databaseFieldDefinition;
                }
              }
            }
            return null;
          }
          

Inheritance Hierarchy

Object
   EngineObjectBase
      SCRCollection
         FieldDefinitions
            DatabaseFieldDefinitions

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

DatabaseFieldDefinitions Members
CrystalDecisions.CrystalReports.Engine Namespace