Partilhar via


Propriedade PublisherAddress

Especifica o endereço de rede usado ao conectar o Editor.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (em System.Data.SqlServerCe.dll)

Sintaxe

'Declaração
Public Property PublisherAddress As String
    Get
    Set
'Uso
Dim instance As SqlCeReplication
Dim value As String

value = instance.PublisherAddress

instance.PublisherAddress = value
public string PublisherAddress { get; set; }
public:
property String^ PublisherAddress {
    String^ get ();
    void set (String^ value);
}
member PublisherAddress : string with get, set
function get PublisherAddress () : String
function set PublisherAddress (value : String)

Valor da propriedade

Tipo: System. . :: . .String
O endereço de rede usado ao conectar o Editor.

Comentários

A propriedade PublisherAddress é necessária quando PublisherNetwork é definido com um valor diferente de DefaultNetwork.

Especifique esta propriedade para indicar como o Provedor de Replicação do SQL Server se comunica com o Editor. Por exemplo, se o Agente de Replicação do SQL Server Compact 3.5 e o Publicador estiverem localizados em dois sistemas diferentes e esses dois sistemas se comunicarem pela Internet, PublisherNetwork poderá ser definido como TcpIpSockets, e PublisherAddress poderá ser definido como um endereço IP específico.

Se o valor PublisherNetwork for definido como TcpIpSockets ou MultiProtocol, então o formato do valor PublisherAddress será 'IP address,port number' (por exemplo, 111.11.11.11,1433').

Exemplos

O exemplo a seguir define a propriedade PublisherAddress do objeto SqlCeReplication.

Dim repl As SqlCeReplication = Nothing

Try
    ' Instantiate and configure SqlCeReplication object
    '
    'NOTE: when possible, prompt users to enter security 
    'credentials at runtime. If you store credentials in a file, 
    'you must secure the file to prevent unauthorized access.
    '
    repl = New SqlCeReplication()
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll"
    repl.InternetLogin = "MyInternetLogin"
    repl.InternetPassword = "<enterStrongPassword>"
    repl.Publisher = "MyPublisher"
    repl.PublisherDatabase = "MyPublisherDatabase"
    repl.PublisherLogin = "MyPublisherLogin"
    repl.PublisherPassword = "<enterStrongPassword>"
    repl.Publication = "MyPublication"
    repl.Subscriber = "MySubscriber"
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf"

    ' Create the local SQL Mobile Database subscription
    '
    repl.AddSubscription(AddOption.CreateDatabase)

    ' Synchronize to the SQL Server to populate the Subscription 
    '
    repl.Synchronize()
Catch
    ' Handle errors here
    '
Finally
    ' Dispose the repl object
    '
    repl.Dispose()
End Try
SqlCeReplication repl = null;

try
{
    // Instantiate and configure SqlCeReplication object
    //
    //NOTE: when possible, prompt users to enter security 
    //credentials at runtime. If you store credentials in a file, 
    //you must secure the file to prevent unauthorized access.
    //
    repl = new SqlCeReplication();
    repl.InternetUrl = "https://www.adventure-works.com/sqlce/sqlcesa35.dll";
    repl.InternetLogin = "MyInternetLogin";
    repl.InternetPassword = "<enterStrongPassword>";
    repl.Publisher = "MyPublisher";
    repl.PublisherDatabase = "MyPublisherDatabase";
    repl.PublisherLogin = "MyPublisherLogin";
    repl.PublisherPassword = "<enterStrongPassword>";
    repl.Publication = "MyPublication";
    repl.Subscriber = "MySubscriber";
    repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";

    // Create a local SQL Mobile Database subscription
    //
    repl.AddSubscription(AddOption.CreateDatabase);

    // Synchronize to the SQL Server database
    //
    repl.Synchronize();
}
catch (SqlCeException)
{
    // Handle errors here
    //
}
finally
{
    // Dispose the repl object
    //
    repl.Dispose();
}

Consulte também

Referência

SqlCeReplication Classe

Membros SqlCeReplication

Namespace System.Data.SqlServerCe