Share via


How to: Specify the Location of the Temporary Database by Using the Replication and RDA Objects

You can explicitly specify the ___location and size of the temporary database by using the Microsoft SQL Server 2005 Compact Edition Replication and Remote Data Access objects. To specify the ___location, add the temp path, temp file directory, or ssce:temp file directory parameter to the connection string (set with either SqlCeReplication.SubscriberConnectionString or SqlCeRemoteDataAccess.LocalConnectionString). To specify the size, add the temp file max size parameter.

Note

The ___location you specify for the temporary database must already exist.

Example

The following example shows how to use the SubscriberConnectionString property in the Replication object to set the ___location of the temporary database.

SqlCeReplication ceRepl = new SqlCeReplication();
ceRepl.SubscriberConnectionString = @"Persist Security Info = False;
   Temp File Directory = '\TempDB\'; Temp File Max Size = 256;
   Data Source = 'SalesData.sdf';
   Password = '<password>'; File Mode = 'shared read';
   Max Database Size = 256; Max Buffer Size = 1024";
Dim repl As New SqlCeReplication()
repl.SubscriberConnectionString = "Persist Security Info = False;" & _
   "Temp File Directory = '\TempDB\'; Temp File Max Size = 256;" & _
   "Data Source = 'SalesData.sdf';" & _
   "Password = '<password>'; File Mode = 'shared read';" & _
   "Max Database Size = 256; Max Buffer Size = 1024"

The following example shows how to use the LocalConnectionString property in the RemoteDataAccess object to set the ___location of the temporary database.

SqlCeRemoteDataAccess rda = new SqlCeRemoteDataAccess();
rda.LocalConnectionString = @"Persist Security Info = False;
   Temp Path = '\TempDB\'; Data Source = 'SalesData.sdf';
   Password = '<password>'; File Mode = 'shared read';
   Max Database Size = 256; Max Buffer Size = 1024";
Dim rda As New SqlCeRemoteDataAccess()
rda.LocalConnectionString = "Persist Security Info = False;" & _
   "Temp Path = '\TempDB\'; Data Source = 'SalesData.sdf';" & _
   "Password = '<password>'; File Mode = 'shared read';" & _
   "Max Database Size = 256; Max Buffer Size = 1024"