SQL CE compatibility issues under the. NET campact Framework

Source: Internet
Author: User

For data storage in the. NET campact Framework Common SQL CE databases, SQL CE is a file database with an extension of *.sdf, once named SQL Server for Windows CE and SQL Server Mobile editio N, the latest version is named SQL Server Compact Edition, in the article unified called SQL CE. This article mainly describes the SQL CE 3.0 and SQL CE 3.5 compatibility issues.

The. NET campact Framework develops SQL CE unified use System.Data.SqlServerCe.dll, which encapsulates namespaces and classes that are consistent, so program code is uniform. However, because the *.SDF data file format is not the same, MS provides a different version of System.Data.SqlServerCe.dll, and its related components are stored in the same location.

Under VS2005 development defaults to the Cf.net version of 2.0, while the default use of the SQL CE version is 3.0. Generally in the following directory C:\Program Files\Microsoft Visual Studio 8 \smartdevices\sdk\sql server\mobile\v3.0 or C:\Program files\ Microsoft SQL Server edition\device\mobile\v3.0 Mobile.

Under VS2008, the default version of Cf.net is 3.5, but you can choose 2.0, and the SQL CE version used by default is 3.5. Typically stored in the C:\Program Files\Microsoft SQL Server Compact edition\v3.5\devices\.

SDF data files and System.Data.SqlServerCe.dll are one-to-one binding, 3.5 SDF data files can only use 3.5 of the sqlserverce.dll,3.0 SDF data file can only use 3.0 of the SqlServerCe.dll, incompatible with each other.

If you use 3.0 SqlServerCe.dll to access the 3.5 SDF data file, there are the following exceptions

System.Data.SqlServerCe.SqlCeException : You are trying to  access an older version of a SQL Server 

Mobile  database. If this is a SQL Server CE 1.0 or 2.0 database,  run upgrade.exe. 

If this is a SQL Server Mobile 3.0  database, run Compact / Repair. 

[ Db version =  3505053,Requested version = 3004180,File name = DB\db.sdf ]
at System.Data.SqlServerCe.SqlCeConnection.ProcessResults()
at System.Data.SqlServerCe.SqlCeConnection.Open()
at System.Data.SqlServerCe.SqlCeConnection.Open()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.