Mark Cooray
Hi
Thankx again.
I had an issue with my SQL mobile before.... Pls Refer below : So I implimented the solution provided by this article.
as mentioned in this I am including following .dll files.
sqlceca30.dll, sqlcecompact30.dll, sqlceer30en.dll, sqlceme30.dll, sqlceoledb30.dll, sqlceqp30.dll, sqlcese30.dll
Deploying SQL Mobile via ClickOnce
To get a feel how easy it is to deploy SQL Mobile with Click Once, here¡¯s a quick walk through:
- Using Visual Studio 2005 (Whidbey) create a new Windows Forms project.
- Using the Data Sources Window choose to add a new Database Data Source for the Northwind sample database
- On the Choose your Data Connection step, click New Connection
- In the top of the dialog you can change the Data Source ¨C I know this term is overloaded¡
- Click the [Change¡] button and select Microsoft SQL Server Mobile Edition as the data base data source
- Your now given a Connection dialog where you can either create a new SQL Mobile Database or you can choose an existing SQL Mobile database.
- Click [Browse] and you should see Northwind.sdf . .sdf is the SQL Mobile data file extension.
If for some reason you don¡¯t see the sample database, verify you¡¯re looking in C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0
- Once you select the sample database, click Ok, and click next to the Save Connection step
- At this point you¡¯re prompted to copy the .sdf file to your project. Choose yes so the data file travels with your application.
- Again, choose yes save the connection string in the Settings file.
- You can now choose which tables. For the purposes of this simplified demo, just choose Employees and click finish.
- This creates a strongly typed DataSet, new in Whidbey for devices, for your Northwind SQL Mobile file.
- Drag the employees table from the Data Sources Window to the Form1 design surface. You can choose the Smart Tag on the grid to dock-fill.
So far, this is the same experience for server based databases.
At this point you¡¯d think you can run your application, and you can certainly try hitting F5. But, you¡¯ll get an exception stating the runtime can¡¯t find sqlceme30.dll. ADO.net for SqlMobile can¡¯t find the SQL Mobile runtime. No problem, we¡¯ll just add it to our project.
But wait you say. Isn¡¯t that an install Or a ClickOnce boot strapper thingy Nope. The SQL Mobile runtime is a few very small dlls. To get the full functionality for SQL Mobile you only need to add less then 1.4mb to your project. That¡¯s less then some home page images.
- To add the runtime we need to place these files in a path that can be found by ADO.net. You could MSI install these to the System32 directory, but because they¡¯re so small, why not just ship them with your app
- Within Solution Explorer, select your project and choose Add Existing Item
- Navigate to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
- Change the files of type to all files
- Click in the file list window and type sqlce to get to the files that start with these letters
- Shift select all 7 files, sqlcera30.dll, sqlcecompact30.dll, sqlceer30en.dll, sqlceme30.dll, sqlceoledb30.dll, sqlceqp30.dll, sqlcese30.dll and click Add.
You now have the runtime in the project, but it¡¯s not in the execution path.
- Select all 7 files in solution explorer and select the property grid.
- Change the Copy to Output Directory to Copy if newer
This will make sure these files are copied to the output directory and can be found at runtime.
- Hit F5 to test your app.
Voila. You now have a local database ready to go.
Deploying with ClickOnce
Because these dll¡¯s are just private to the project, you can simply publish your app just as you would normally. Post Beta 2 however, you¡¯ll have a minor problem. ClickOnce actually places ¡°Data¡± files in a different directory then you¡¯re app. For more info check out my Tech Ed blog and Data Directory sample.