Partager via


Propriété SyncTable.TableName

Obtient ou définit le nom de la table dans la base de données client.

Espace de noms: Microsoft.Synchronization.Data
Assembly: Microsoft.Synchronization.Data (dans microsoft.synchronization.data.dll)

Syntaxe

'Déclaration
Public Property TableName As String
'Utilisation
Dim instance As SyncTable
Dim value As String

value = instance.TableName

instance.TableName = value
public string TableName { get; set; }
public:
property String^ TableName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_TableName ()

/** @property */
public void set_TableName (String value)
public function get TableName () : String

public function set TableName (value : String)

Valeur de propriété

Nom de la table dans la base de données client.

Exemple

L'exemple de code suivant provient d'une classe qui dérive de SyncAgent. Le code crée deux groupes de synchronisation et trois tables de synchronisation. La table Customer est ajoutée au groupe Customer, et les tables OrderHeader et OrderDetail sont ajoutées au groupe Order. Toutes les tables sont téléchargeables uniquement. Si une table existe au niveau du client, elle est supprimée, puis créée à nouveau lors de la synchronisation initiale. Pour afficher ce code dans le contexte d'un exemple complet, consultez Procédure : filtrer des lignes et des colonnes.

//Create two SyncGroups so that changes to OrderHeader
//and OrderDetail are made in one transaction. Depending on
//application requirements, you might include Customer
//in the same group.
SyncGroup customerSyncGroup = new SyncGroup("Customer");
SyncGroup orderSyncGroup = new SyncGroup("Order");

//Add each table: specify a synchronization direction of
//DownloadOnly.
SyncTable customerSyncTable = new SyncTable("Customer");
customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
customerSyncTable.SyncDirection = SyncDirection.DownloadOnly;
customerSyncTable.SyncGroup = customerSyncGroup;
this.Configuration.SyncTables.Add(customerSyncTable);

SyncTable orderHeaderSyncTable = new SyncTable("OrderHeader");
orderHeaderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
orderHeaderSyncTable.SyncDirection = SyncDirection.DownloadOnly;
orderHeaderSyncTable.SyncGroup = orderSyncGroup;
this.Configuration.SyncTables.Add(orderHeaderSyncTable);           

SyncTable orderDetailSyncTable = new SyncTable("OrderDetail");
orderDetailSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;
orderDetailSyncTable.SyncDirection = SyncDirection.DownloadOnly;
orderDetailSyncTable.SyncGroup = orderSyncGroup;
this.Configuration.SyncTables.Add(orderDetailSyncTable);
'Create two SyncGroups so that changes to OrderHeader
'and OrderDetail are made in one transaction. Depending on
'application requirements, you might include Customer
'in the same group.
Dim customerSyncGroup As New SyncGroup("Customer")
Dim orderSyncGroup As New SyncGroup("Order")

'Add each table: specify a synchronization direction of
'DownloadOnly.
Dim customerSyncTable As New SyncTable("Customer")
customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
customerSyncTable.SyncDirection = SyncDirection.DownloadOnly
customerSyncTable.SyncGroup = customerSyncGroup
Me.Configuration.SyncTables.Add(customerSyncTable)

Dim orderHeaderSyncTable As New SyncTable("OrderHeader")
orderHeaderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
orderHeaderSyncTable.SyncDirection = SyncDirection.DownloadOnly
orderHeaderSyncTable.SyncGroup = orderSyncGroup
Me.Configuration.SyncTables.Add(orderHeaderSyncTable)

Dim orderDetailSyncTable As New SyncTable("OrderDetail")
orderDetailSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable
orderDetailSyncTable.SyncDirection = SyncDirection.DownloadOnly
orderDetailSyncTable.SyncGroup = orderSyncGroup
Me.Configuration.SyncTables.Add(orderDetailSyncTable)

Voir aussi

Référence

Classe SyncTable
Membres SyncTable
Espace de noms Microsoft.Synchronization.Data