共用方式為


InternetUrl 屬性

指定用來連接到「SQL Server Compact 3.5 伺服器代理程式」的 URL。

命名空間:  System.Data.SqlServerCe
組件:  System.Data.SqlServerCe (在 System.Data.SqlServerCe.dll 中)

語法

'宣告
Public Property InternetUrl As String
    Get
    Set
'用途
Dim instance As SqlCeReplication
Dim value As String

value = instance.InternetUrl

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

屬性值

型別:System. . :: . .String
URL 字串。

備註

這是必要的屬性。如果您需要覆寫預設的通訊埠,可以加入通訊埠編號(HTTP 的預設通訊埠是 80,而 HTTPS 的預設通訊埠是 443)。例如,將 InternetUrl 設定為 "http://yourserver:810/ssce/sqlcesa35.dll",其中通訊埠 810 是用於 IIS 伺服器。

範例

下列範例會在 SqlCeReplication 物件上設定 InternetUrl 屬性。

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();
}

請參閱

參考

SqlCeReplication類別

SqlCeReplication 成員

System.Data.SqlServerCe 命名空間