How to: Specify the Location of the Temporary Database by Using ADO.NET (Programmatically)
You can explicitly specify the location and size of the temporary database by using the Microsoft .NET Compact Framework Data Provider for SQL Server Compact 4.0. To do this, add the temp file directory and temp file max size properties to the connection string, as follows:
"temp file directory = temp_database_location; temp file max size=128;"
The location you specify for the temporary database must already exist.
The following example shows how to pass the temporary database location in the connection string of the SqlCeConnection object.
SqlCeConnection conn = new SqlCeConnection(); conn.ConnectionString = @"Persist Security Info = False; Temp File Directory = '\TempDB\'; Temp File Max Size = 256; Data Source = 'SalesData.sdf'; Password = '<enterStrongPasswordHere>'; File Mode = 'shared read'; Max Database Size = 256; Max Buffer Size = 1024"; conn.Open();