.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

IDataSourceContainerOptions.DataMember Property

Gets or sets a specific data member in a data source which contains several tables or members.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v21.2.Core.dll

Declaration

string DataMember { get; set; }

Property Value

Type Description
String

A string that identifies a member in the data source, such as the table name.

Remarks

Use the DataMember property if the IDataSourceContainerOptions.DataSource property specifies a dataset which contains several data tables or other objects. If the data source is a single data table, data view or any custom created data source object, the DataMember is irrelevant.

Example

' Register a Snap data source and open a document template.
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    ' Load a template.
    Me.snapControl1.Document.LoadDocument("template.snx", SnapDocumentFormat.Snap)
    ' After loading a template, add data sources to the collection.
    Me.snapControl1.DataSources.Add("MyDS", CreateDataSource())
    ' And specify the data source used for mail merge (the Categories table of the MyDS data source).
    Me.snapControl1.Options.SnapMailMergeVisualOptions.DataSourceName = "MyDS"
    Me.snapControl1.Options.SnapMailMergeVisualOptions.DataMember = "Categories"
End Sub

Private Shared Function CreateDataSource() As Object
    Dim ds As New DataSet()
    Dim adapter As New SqlDataAdapter("SELECT * FROM Categories; SELECT * FROM Products", New SqlConnection(My.Settings.Default.NWindConnectionString))
    adapter.TableMappings.Add("Table", "Categories")
    adapter.TableMappings.Add("Table1", "Products")
    adapter.Fill(ds)
    ds.Relations.Add("CategoriesProducts", ds.Tables("Categories").Columns("CategoryId"), ds.Tables("Products").Columns("CategoryId"))
    Return ds
End Function
See Also