2.3.1.7. Visual Studio 2008 does not recognize Windows Mobile 6 SDK when the SDK is already installed.
If a user installs Visual Studio 2008 on a computer that already has Windows Mobile 6 SDK, Visual Studio 2008 will not recognize the SDK. Repairing Windows Mobile 6 SDK will not solve this.
To resolve this issue:
1. Uninstall Windows Mobile 6 SDK.
2. Reinstall Windows Mobile 6 SDK.
2.3.1.8 SQL Server Compact 3.5 does not use the Encrypt property of the SqlCeConnection class.
The Encrypt property in the SqlCeConnection class should not be used. The property is retained in SQL Server Compact 3.5 only for backward compatibility.
To resolve this issue:
Use the encryption mode property of the SqlCeConnection class to encrypt SQL Server Compact 3.5 database files. Uses of encryption mode, together with code samples, are as follows.
1. To create a new encrypted SQL Server Compact 3.5 database.
SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;");
engine.CreateDatabase();
2. To upgrade a SQL Server 2005 Compact Edition (version 3.1) or SQL Server 2005 Mobile Edition (version 3.0) database to an encrypted SQL Server Compact 3.5 database.
SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;Password=passw0rd;");
engine.Upgrade ("Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;");
3. To change the encryption mode of an existing SQL Server Compact 3.5 database.
SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;Password=passw0rd;");
engine.Compact("Data Source=Northwind.sdf;encryption mode=ppc2003 compatibility;Password=passw0rd;");
4. To encrypt an unencrypted SQL Server Compact 3.5 database.
SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf");
engine.Compact("Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;");
2.3.1.9. Design-time experience in Smart Device programs cannot be used when SSC 3.1 database is targeted.
A Smart Device programmer is unable to use any of the designer features, such as Add Datasource, Add New Connection, Create Database, Generate Data Forms, and drag-and-drop datasource objects onto the form designer, when she is programming against a SQL Server Compact Edition 3.1 database. The Smart device designer features default to SQL Server Compact 3.5 database.
To resolve this issue:
Use Visual Studio 2005 Service Pack 1 to program against SQL Server Compact Edition 3.1 database for Smart Device programs. For more information about using Visual Studio 2008 with SQL Server Compact Edition 3.1 database, see http://go.microsoft.com/fwlink/?LinkID=101885.
2.3.1.10. During the upgrade of a Visual Studio 2005 project to Visual Studio 2008, the encrypted SQL Server Compact database is not upgraded, and ClickOnce applications must be re-published.
Database files (*.sdf) that are created by earlier version of SQL Server Compact are not compatible with SQL Server Compact 3.5. Un-encrypted database files from earlier versions of SQL Server Compact are upgraded when a Visual Studio 2005 project is upgraded in Visual Studio 2008. Encrypted database files must be manually upgraded. If the Visual Studio 2005 project uses ClickOnce to publish applications, the application should be re-published after the project has been upgraded in Visual Studio 2008.
To resolve this issue:
Upgrade the encrypted database files by completing the following steps.
1. Click Data.
2. Click Add New Data Source.
3. Click Add Connection. If an earlier version of the database file is open, a message appears. If you click OK, the Upgrade to SQL Server Compact 3.5 Database dialog box appears.
Alternatively the SqlCeEngine.Upgrade API can be used for programmatic scenarios, as shown in the following code example.
SqlCeEngine engine = new SqlCeEngine("Data Source=Northwind.sdf;Password=passw0rd;");
engine.Upgrade ("Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;");
If the project uses ClickOnce to publish applications, the application should be re-published after it has been upgraded in Visual Studio 2008. When you re-publish the Click Once application in Visual Studio 2008, you may see a warning that SQL Server 2005 Compact Edition prerequisite cannot be found for bootstrapping. You can ignore the warning.
2.3.1.11. SQL Server Compact 3.5 data types for parameters such as SqlDbType or DbType should be explicitly set.
If the data types for parameters such as SqlDbType or DbType are not explicitly set, an exception will be thrown.
To resolve this issue:
Explicitly set the data type for parameters such as SqlDbType or DbType. Doing this is critical in case of BLOB data types (image and ntext). A code example follows.
SqlCeEngine engine = new SqlCeEngine(connString);
engine.CreateDatabase();
engine.Dispose();
SqlCeConnection conn = new SqlCeConnection(connString);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128), blob ntext);";
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);";
SqlCeParameter paramName = cmd.Parameters.Add("name", SqlDbType.NVarChar, 128);
SqlCeParameter paramBlob = cmd.Parameters.Add("blob", SqlDbType.NText);
paramName.Value = "Name1";
paramBlob.Value = "Name1".PadLeft(4001);
cmd.ExecuteNonQuery();
2.3.2. ADO.NET
2.3.2.1. After Visual Studio 2008 is upgraded, a warning is displayed that a MDAC 2.8 prerequisite is missing or that a built application does not run on Windows 2000 after it is installed.
You may encounter one of the following problems:
- A Visual Studio 2005 project was upgraded to Visual Studio 2008, and now a build warning says that a prerequisite is missing.
- A built application that depends on MDAC does not run on Windows 2000.
- Windows 2000 users cannot run a ClickOnce application because MDAC is missing.
To resolve this issue:
- If you do not require MDAC and you are getting a build warning, open the Prerequisites dialog box and then clear the MDAC prerequisite.
- If you are targeting Windows 2000 clients and require the MDAC prerequisite, get the Bootstrapper package from the Internet, as follows.
1. Open the Prerequisites dialog box and then click 'Check Microsoft Update for more redistributable components'. Doing this will open http://go.microsoft.com/fwlink/?linkid=40981.
2. On the Web page, download the MDAC Bootstrapper package and save it in a new folder in \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\.
- Get the Bootstrapper package from Visual Studio 2005.
1. If Visual Studio 2005 is installed on the same computer, you can copy the MDAC28 folder in \Program Files Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ and then paste it in \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\.