sql mobile database connection on a desktop application

Hello,

Was wondering if its possible with VS 2005 to create and populate a SQL Server Ce database on the desktop

Reason why I'm asking is it takes a very long time (~40 minutes) to process xml and insert the values into the sdf database on the Pocket PC. I would assume it is much quicker to create the database and insert records on the desktop. Any suggestions would be appreciated.

Thanks




Answer this question

sql mobile database connection on a desktop application

  • Koen Willemsen

    Hi,

    SQLMobile is supported only on devices and on the Tablet PC. I'm afraid you can't use it for normal desktop applications.

    Thanks,
    Sriram Krishnan
    Program Manager-  Visual Studio for Devices

  • danielpitz

    Hi,

    i try to make a connection on a sql mobile database (*.sdf) from a desktop application made with VS2005 Beta 2 but i didn't manage. I dont' know where is my problem....

    Is it possible or have I done something wrong

    thanks.

    Dotcom

  • ZackL

    Here's some info on connecting to SQL Mobile w/VS and Tablet PC
    http://blogs.msdn.com/smartclientdata/archive/2005/07/15/439008.aspx
    Steve

  • jch_00

    I have addressed this issue for SQL CE 2.0 by developing a specialized component: http://www.primeworks.pt/Products/DesktopSqlCe.html. I will soon port this to SQL Mobile.

  • Scarlett Lee MSFT

    You can also manage SqlServerCe databases directly within Visual Studio without having to install the full Sql Server product. You can open the database and edit the table, but it's in a grid view and you have to manually enter the data. It doesn't sound like that's going to help you much given the amount of information you have :)

    It is technically possible to run SqlMobile against the desktop, you do have to do a bit of work though. There is a topic on this in the Sql Server Mobile topics of SqlServer (the title is "How To: Build and Deploy a Windows Application (SQL Server Mobile)"). Here's the contents of the topic:

    To build and deploy a SQL Server Mobile Windows application
    1. Open Windows Explorer and locate the following directory:

      C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

    2. Select and copy the following files:

    .dll file Function

    sqlceca30.dll

    The SQL Server Mobile Client Agent. Required for applications that connect to SQL Server by using replication or remote data access.

    sqlcecompact30.dll

    Provides the compact database functionality. Required if your application will use compaction.

    sqlceer30[language].dll

    Contains error strings for SQL Server Mobile-generated errors. Required for all SQL Server Mobile applications.

    sqlceme30.dll

    Contains code required by the System.Data.SqlServerCe.dll file. Required for all SQL Server Mobile applications.

    sqlceoledb30.dll

    Provides OLE DB connectivity to SQL Server Mobile databases. Required only if your application uses OLE DB to connect to the SQL Server Mobile database.

    sqlceqp30.dll

    The SQL Server Mobile Query Processor. Required for all SQL Server Mobile applications.

    sqlcese30.dll

    The SQL Server Mobile Engine. Required for all SQL Server Mobile applications.

    System.Data.SqlServerCe.dll

    Contains the SQL Server Mobile namespace, which you reference in your application code. Required for all SQL Server Mobile applications.

    1. Locate the bin folder of your Windows application.

    2. Paste the files you copied in step 2 to the bin folder.

    3. In your Microsoft Visual Studio 2005 project, add a reference to the copy of the System.Data.SqlServerCe.dll file that is in the bin folder. For more information, see Building a SQL Server Mobile Application for Tablet PCs.

    4. When you deploy your application, copy all the .dll files together with your application's .exe and .dll files. This enables your application to use SQL Server Mobile without requiring a separate product installation.

    Note that while this is technically possible to do and it's likely ok to do this for a little test app during your development, when Visual Studio 2005 ships you will have to make sure that you conform to the terms of the SqlMobile licensing agreements if you ever plan on distributing a desktop application that uses SqlMobile.

    Hope this helps!

    Neil



  • ChristopheGalli

    I manage to create a sql mobile database on a desktop with the informations of the topic : http://forums.microsoft.com/msdn/ShowPost.aspx PostID=16263 and after transfert it whith rapi to the mobile device.

    But it would be better for me if i can directly update a sql database which would be located on the mobile device.... and i didn't manage...

    thanks.

  • Nicol

    I've merged in a second thread that also asks about this issue. See the top of this (new) thread for details on how to get it working with your app.

    Neil

  • Paul Hood

    The problem is that downloading 55MB for SQL Server 2005 Express Edition Beta just to run my application of 200kb is a little bit disproportionnal...

    but thank you for answering me.

  • Kooldino

    Hi to all in this forum. have been involved in this discussion for over 3 weeks now and here is the perspective from what I now understand.

    MS does NOT support direct management of  Mobile SQL:data on the desktop EXCEPT for the following

    You have an SQL Server product  (NOT SQL Server Express)

    0r.

    You have a Tablet PC 

    HOWEVER

    You can manage your data on the desktop by right clicking the relevant table within Server Explorer at development stage with your smart device application but this is only on a record by record basis. There is no bulk cut and paste facility.

    A POSSIBLE SOLUTION

    is to use the system.io object to export your data to a text file and read this in to your Mobile SQL application.

    I agree this is not a very satisfactory solution. 

    Regards

    David  


  • Jonrio

    I have add these 8 dll im my project but it still doesn't work on a computer without vs2005.

    The error tell me that i must have vs2005, sql server 2005 ot tablet PC SKU to make it work... Is it the only solution

    Thanks, Julien

  • Ruden

    Julien,

    When you deploy the solution, make sure you include SQL Server 2005 Express Edition Beta as a prerequisite. Once I did that and included the dll in the application path, I could use a SQL Mobile database on the desktop.

    Regards,

    Peter



  • Simmy7

    Thanks for your response Jung,

    I was able to create a .sdf database and insert records on the desktop.  The key was to place the following dll in the application executable directory.

    sqlceca30.dll
    sqlcecompact30.dll
    sqlceer30en.dll
    sqlceme30.dll
    sqlceoledb30.dll
    sqlceqp30.dll
    sqlcese30.dll

    Only concern now is I could not add a reference to these dll's in VB.net and when I tried to install the application on another computer (without VS 2005), the application failed to generate the .sdf files.

    Any advice on how/what files are needed for distribution

    Thanks

    Peter



  • JarLin

    Hello...

    yes, you can manage SQL Mobile Database on your desktop through the
    SQL Server Management Studio.

    you may need to install SQL Server Mobile Serer Tools:
    location:
    drive>:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE folder, double-click Sqlce30setupen.msi

    or from ms download:
    http://www.microsoft.com/downloads/details.aspx FamilyId=0A6174A4-C009-4768-8284-698C32EC84E3&displaylang=en

    from MSDN:
    ===============================
    You can create or connect to a Microsoft SQL Server 2005 Mobile Edition (SQL Server Mobile) database on a device or on a desktop computer.

    A SQL Server Mobile database is stored in a file with the .sdf extension. The file contains the complete contents of the database and can be up to 4 GB. SQL Server Mobile can access and modify the database file, both on a smart device and on a Tablet PC. It also supports use on desktop computers by using SQL Server Management Studio and other tools.

    By using either SQL Server Management Studio or Transact-SQL statements, you can connect to an existing database on a desktop. You can also create and modify databases from a desktop. You can then view the design of that database in a tree hierarchy by using the object tree. Each node has a shortcut menu with commands for modifying the database or retrieving information about the database.

    Some of the functions you can perform in a SQL Server Mobile database include the following:

    • Creating, deleting, and editing tables and the associated data.

    • Creating, maintaining, and deleting indexes.

    • Examining information schema views and data types.

    • Initiating replication and remote data access (RDA) synchronization.

    You can use Transact-SQL commands, including data manipulation language (DML), data definition language (DDL), and functions, with the SQL Server Mobile database.

    You can also use replication or RDA with a database that is exposed through native and managed APIs.
    ===============================



  • Maryello

    Hi Neil, your solution works fine for a Windows app on the desktop. I did not install the full SQL Server product, as I have SQL Server 2000 with Enterprise Manager installed and I am a bit cautious, not knowing if it will break the SQL 2000 installation.
    I want to do this from a Web app on the same computer, so I tried something similar for the Web app, referenced the mentioned DLL. At first I ran it without the additional DLLs (only with the reference) and it gave an error as expected.
    I then added the additional DLLs to the "bin" folder of the Web app, and this time it came up with with the following error:
    "SQL Mobile usage is restricted on this platform. To use SQL Mobile, you must install SQL Server 2005, Visual Studio 2005, or the Tablet PC SKU".

    Do you know of a work-around for this, if not, will I screw my SQL 2000 installation with an SQL 2005 installation

    Thanks.

  • sql mobile database connection on a desktop application