Even though, SQL Server Management (for studio 2005) allows you to connect to an SQL Server CE database directly on mobile, but when you try to do that, it throws error saying that path is not valid.
I have been searching for this a lot here and there, but no answer. I also talked to peoples on forums, but everyone said that you need a third party tool to do this. Well, after a lot of research, I finally found that it is possible without any third party control/tool. You can do this using Microsoft SQL Server Management libraries. Here is how you can do that.
Create a new project (windows forms application) and add the reference of C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\Microsoft.SqlServerCe.Client.dll to your solution. Please note that you must have SQL Server management studio installed in order to find this dll. Once you have that, you are ready to connect to SQL Server CE database file on mobile device.
Use the following to open conneciton:
Dim conn AsNew Microsoft.SqlServerCe.Client.SqlCeConnection(
"Data Source ='Mobile Device\My Documents\Database.sdf';")
conn.Open()
--Do your stuff here.
conn.Close();
Thats all! Now you can interact with SQL CE Database directly on your Pocket PC, without copying that to local disk.
P.S: I was just told by a person that you are not allowed to distribute this dll with your application, I am not sure about this, so if someone knows the licensing issue, please write here.
Sameers