I have listed down few steps to connect LINQ to SQL server Compact.
Make sure you have installed right version of SQL Server Compact 3.5 installed. If you need to install it, you can find the installer here: http://www.microsoft.com/Sqlserver/2005/en/us/compact-downloads.aspx
Step 1: Create your new project within Visual Studio
It doesn’t matter if it’s a Windows Forms or WPF application. For this example, I’ll be creating a WPF application.
Step 2: Create your SQL Server Compact database. For Example: YourDatabase.sdf
You can do this by right-clicking on your Solution within the Solution Explorer and selecting "Add – New Item…" then select the "Data" category on the left and "Local Database" on the right.
Step 3: Add some Tables to the Database
You can do this within Visual Studio 2008 using the "Server Explorer". The easiest way to open up the Database within the Server Explorer is to just double click it withinthe Solution Explorer.
Also, in this example I’m just going to create a "Person" table with ID, FirstName and LastName columns.
Step 4: Create a .dbml descriptor file for the Database
To do this you need to use the SqlMetal.exe tool. Just type the following into the Visual Studio 2008 Command Prompt:
SqlMetal.exe YourDatabase.sdf /dbml:YourDatabase.dbml
By default, the SqlMetal.exe is located at drive:\Progream Files\Microsoft SDKs\Windows\vn.nn\bin.
Step 5: Add the Existing .dbml file to your project
Once you add the .dbml file, Visual Studio 2008 will automatically generate the .NET code (C# or VB.NET) for the System.Data.Linq.DataContext class that you’ll use to access your data.
Step 6: Start Coding away using LINQ to SQL!
You can now code using LINQ and your new System.Data.Linq.DataContext class against your database.
– Ananth Ramasamy Meenachi http://www.msarm.com