Upgrading to Visual Studio 2008/SQL Server Compact Edition 3.5, Listing 1

SqlCeConnection cn = new SqlCeConnection()
cn.ConnectionString = [connect string];


tryConnection:
    try
    {
        cn.Open();
    }
    catch (SqlCeException ex)
    {
        if (ex.NativeError == 25138)
        {
            SqlCeEngine sce = new SqlCeEngine(cn.ConnectionString);
            sce.Upgrade();
            goto tryConnection;
        }
    }

comments powered by Disqus
Most   Popular
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.