Propriedade SubscriberConnectionString
Especifica a cadeia de conexão com o banco de dados do SQL Server Compact 3.5.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (em System.Data.SqlServerCe.dll)
Sintaxe
'Declaração
Public Property SubscriberConnectionString As String
Get
Set
'Uso
Dim instance As SqlCeReplication
Dim value As String
value = instance.SubscriberConnectionString
instance.SubscriberConnectionString = value
public string SubscriberConnectionString { get; set; }
public:
property String^ SubscriberConnectionString {
String^ get ();
void set (String^ value);
}
member SubscriberConnectionString : string with get, set
function get SubscriberConnectionString () : String
function set SubscriberConnectionString (value : String)
Valor da propriedade
Tipo: System. . :: . .String
A cadeia de conexão com o banco de dados do SQL Server Compact 3.5.
Comentários
Esta propriedade dá suporte a todas as propriedades ConnectionString, exceto "informações de persistência de segurança".
Há suporte para os valores de Locale Identifier ao criar um novo banco de dados usando o método AddSubscription. Use o Unique LCID como valor de Locale Identifier. Para obter uma lista de valores de Unique LCID, consulte o tópico Collate na seção de Referência do SQL dos Manuais Online do SQL Server Compact 3.5. Verifique se há suporte para a localidade no dispositivo no qual o banco de dados está sendo criado.
Ao especificar a propriedade Data Source da [SubscriberConnectionString], inclua o caminho completo do arquivo do banco de dados, em vez de um caminho relativo.
Exemplos
O exemplo a seguir define a propriedade SubscriberConnectionString 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();
}