DatabaseFieldDefinition Class

Represents a database field used in the report and provides properties for getting information on database fields in the report.

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


Public Class DatabaseFieldDefinition
    Inherits FieldDefinition
    Implements IDisposable
public class DatabaseFieldDefinition : FieldDefinition, IDisposable


Retrieve a DatabaseFieldDefinition object by index or by name through the Item Property of the DatabaseFieldDefinitions collection.


This example verifies that the data source for a blob field contains a field named Last Name field from a table named Customer table.


      Private Function VerifyBlobFieldObjectDataSource(ByVal myReportDocument As ReportDocument, ByVal reportObjectName As String) As Boolean
        Dim results As Boolean = False
        Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(reportObjectName)
        If myReportObject.Kind = ReportObjectKind.BlobFieldObject Then
          Dim myBlobFieldObject As BlobFieldObject = myReportObject
          Dim myDatabaseFieldDefinition As DatabaseFieldDefinition = myBlobFieldObject.DataSource
          results = (myDatabaseFieldDefinition.Kind = FieldKind.DatabaseField) And _
                    (myDatabaseFieldDefinition.TableName = "Customer") And _
                    (myDatabaseFieldDefinition.ValueType = FieldValueType.StringField) And _
                    (myDatabaseFieldDefinition.Name = "Last Name") And _
                    (myDatabaseFieldDefinition.NumberOfBytes = 16) And _
                    (myDatabaseFieldDefinition.FormulaName = "")
        End If
        VerifyBlobFieldObjectDataSource = results
      End Function
      private bool VerifyBlobFieldObjectDataSource(ReportDocument reportDocument, String reportObjectName)
        bool results = false;
        ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
        if (reportObject.Kind == ReportObjectKind.BlobFieldObject)
          BlobFieldObject blobFieldObject = (BlobFieldObject)reportObject;
          DatabaseFieldDefinition databaseFieldDefinition = blobFieldObject.DataSource;

          results = (databaseFieldDefinition.Kind == FieldKind.DatabaseField) &&
            (databaseFieldDefinition.TableName == "Customer") &&
            (databaseFieldDefinition.ValueType == FieldValueType.StringField) &&
            (databaseFieldDefinition.Name == "Last Name") &&
            (databaseFieldDefinition.NumberOfBytes == 16) &&
            (databaseFieldDefinition.FormulaName == "");
        return results;

Inheritance Hierarchy


Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also


DatabaseFieldDefinition Members
CrystalDecisions.CrystalReports.Engine Namespace