locked
SQL Server and SQL Server Ce RRS feed

  • Question

  • Hi all,

    We have an application that has been developed against an SQL Server database. We also need the same application to run against an SQL Server Ce database for some handheld devices (these will be synced using ADO.NET Sync Services). The reason for this is that the same functionality is required on both the server and the clients. The heart of the application is a typed DataSet that has been primarily built using the built-in designer in VS2008. As this has been built against an SQL Server database, and thus the SqlClient provider, it will not run against an SQL Server Ce database, which requires the SqlServerCe provider. What is the best way to get it to work against SQL Server Ce?

    Obviously we would like to avoid having 2 separate versions of the application so I was thinking of using a provider factory, for example to return either a SqlCommand or a SqlCeCommand through the DbCommand super-type, but this could take a lot of work to implement so I thought I would check with you guys to find out if there are any other options.

    Regards,

    Stephen
    • Moved by Mark.Ashton - MSFT Friday, March 27, 2009 12:54 AM DataAdapter against SQL Server or SQL Server CE (Moved from ADO.NET DataSet to ADO.NET Data Providers)
    Thursday, March 26, 2009 2:48 PM

Answers

  • One or other way you will end up with the factory pattern in your case. If not then your application will not be extensible. You could use DbProviderFactory from .NET Framework as described here

    http://msdn.microsoft.com/en-us/library/wda6c36e.aspx

    It is actually not that difficult even if you create your own factory.
    Val Mazur (MVP) http://www.xporttools.net
    Thursday, April 2, 2009 10:03 AM

All replies

  • How about using nHibernate? This may need some redesigning but a robust database independent solution.

    Thanks,

    Rohit

    Friday, March 27, 2009 6:04 PM
  • As long as you're using functionality that is supported by both providers then the Database Provider Factory should enable you to avoid using provider specific classes.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, March 30, 2009 4:34 PM
  • One or other way you will end up with the factory pattern in your case. If not then your application will not be extensible. You could use DbProviderFactory from .NET Framework as described here

    http://msdn.microsoft.com/en-us/library/wda6c36e.aspx

    It is actually not that difficult even if you create your own factory.
    Val Mazur (MVP) http://www.xporttools.net
    Thursday, April 2, 2009 10:03 AM