Sql server compact edition windows 10

Hi everyone,
  • Remove From My Forums
  • Question

  • Hi everyone,

    I’ve a problem installing  Microsoft SQL Server Compact  3.5 SP1 Server Tools on Windows 10.

    I get the following error:

    «You must first have IIS version 5.1 or later OR IIS Backward Compatibility Components if IIS 7.0 or later installed on this computer before you install Microsoft SQL Server Compact.»

    So i’ve tried to install all of the componentes of Internet Information Services at Windows Features Screen and still didn’t work for me.

    Can please someone help me??

    Thanks

Answers

  • You must install the latest 3,5 SP2 tools


    Please mark as answer, if this was it. Visit my SQL Server Compact blog http://erikej.blogspot.com

    • Marked as answer by

      Monday, November 23, 2015 10:13 AM

  • Thanks,

    installing Microsoft SQL Server Compact  3.5 SP2 Server Tools worked.

    • Marked as answer by
      Lydia ZhangMicrosoft contingent staff
      Monday, December 14, 2015 7:19 AM

  • Remove From My Forums
  • Вопрос

  • Hello,

    I have an app using SQL CE Compact 4 with OLE DB in C++.

    It has always worked and still works perfectly from XP to Windows 7 (I have a dual boot Windows 7/Windows 10 to test)

    But on Windows 10, it doesn’t work anymore.

    It fails at
    IDBProperties::SetProperties with
    DBPROPSET_DBINIT
    returning    
    DB_S_ERRORSOCCURRED

    And the property which fails is
    DBPROP_AUTH_INTEGRATED
    returning
    DBPROP.dwStatus = DBPROPSTATUS_NOTSUPPORTED

    I uninstalled/reinstalled SQL SSCERuntime, but nothing changed.

    Same thing for SQLite/Sql Server Compact Toolbox add-in which doesn’t work in VS 2015 on Windows 10,

    I cannot even create a new database

    I get :

    Thanks for any idea…

Ответы

  • The Automatic Update, Windows 10 version 1703 15063.483 solved this problem by miracle.

    Probably a corrupted key in the registry.

    • Помечено в качестве ответа

      30 июля 2017 г. 16:07

Despite the age and soon complete end of support in July 2021 of SQL Server Compact 4 (launched in 2010), some (actually few) wonder if it is possible to use it with .NET Core. I will show how this can be done here.

These are the high-level steps required to achieve this:

  • Install the SQL Server Compact 4.0 run-time (included in the repository linked below).

  • Create a new executable .NET Core 3.1 project (Console App, WinForm, WPF, Windows Service).

  • Set the project to Target x64:

    <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>netcoreapp3.1</TargetFramework>
      <Platforms>x64</Platforms>
    </PropertyGroup>
  • Copy the System.Data.SqlServerCe.dll file and the entire amd64 folder from the C:Program FilesMicrosoft SQL Server Compact Editionv4.0Private directory to the folder where the .csproj file created above is located.

  • Mark all the 10 copied files a Content, Copy Always, like this one:

    <ItemGroup>
      <None Remove="System.Data.SqlServerCe.dll" />
    </ItemGroup>
    
    <ItemGroup>
      <Content Include="System.Data.SqlServerCe.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
    </ItemGroup>
  • Add a file reference to the System.Data.SqlServerCe.dll file in the root of your project:
    <ItemGroup>
        <Reference Include="System.Data.SqlServerCe">
          <HintPath>System.Data.SqlServerCe.dll</HintPath>
        </Reference>
    </ItemGroup>
  • Install the Windows compatibility pack, to make any required Windows specific .NET APIs available.
    <ItemGroup>
      <PackageReference Include="Microsoft.Windows.Compatibility" Version="3.1.1" />
    </ItemGroup>
  • Finally write some code, and use the System.Data.SqlServerCe name space:
    using System.Data.SqlServerCe;
   
    ...
    var dbFile = "netcore-sqlce.sdf";
    var connectionString = $"Data Source={dbFile}";
     
    using SqlCeEngine engine = new SqlCeEngine(connectionString);
    engine.CreateDatabase();

Your app now includes a complete file based RDBMS, and you can XCOPY deploy the project to any Windows machine, all that is required in the .NET Core 3.1 run-time.

You can see (and clone and run) a complete solution from the GitHub repository here, which also contains an installer for the latest SQL Server Compact 4.0 run-time.

Comments or questions for this blog post?

From Wikipedia, the free encyclopedia

Microsoft SQL Server Compact (EOL, See SQL Express) (SQL CE) is a compact relational database produced by Microsoft for applications that run on mobile devices and desktops. Prior to the introduction of the desktop platform, it was known as SQL Server for Windows CE and SQL Server Mobile Edition.

It includes both 32-bit and 64-bit native support.[1] SQL CE targets occasionally connected applications and applications with an embedded database.[2] It is free to download and redistribute.[2] An ODBC driver for SQL CE does not exist, nor is one planned. Native applications may use SQL CE via OLE DB.

The latest, and last, release is the SQL Server Compact 4.0.[1] In February 2013 SQL Server Compact Edition had been deprecated; no new versions or updates are planned, although Microsoft continued to support the product until July 2021.[3]

Overview[edit]

SQL Server Compact shares a common API with the other Microsoft SQL Server editions.[4] It also includes ADO.NET providers for data access using ADO.NET APIs, and built-in synchronization capabilities,[2] as well as support for LINQ and Entity Framework. Future releases will unify the synchronization capabilities with Microsoft Synchronization Services.[5] Unlike other editions of Microsoft SQL Server, SQL CE runs in-process[5] with the application which is hosting it. It has a disk footprint of less than 2 MB and a memory footprint of approximately 5 MB.[2] SQL CE is optimized for an architecture where all applications share the same memory pool.[6]
Windows Store apps for Windows 8 cannot use SQL Server Compact edition, or any other edition of SQL Server.[7]

Versions

Official Name Common Name Release date Support date
  • SQL Server 2000 Windows CE Edition
  • SQL Server CE 1.0
SQL CE 1.0 2000-10-26[8]
  • SQL Server 2000 Windows CE Edition 1.1
  • SQL Server CE 1.1
SQL CE 1.1 2001-03-21[9]
  • SQL Server 2000 Windows CE Edition 2.0
  • SQL Server CE 2.0
SQL CE 2.0 2002-09-16[10]
SQL Server 2005 Mobile Edition SQL CE 3.0 2006-01-14
SQL Server 2005 Compact Edition SQL CE 3.1 2007-02-19 2016-04-12[11]
SQL Server Compact 3.5 SQL CE 3.5 2008-02-19 2018-04-10[12]
SQL Server Compact 4.0 SQL CE 4.0 2011-04-13 2021-07-13[3]

Legend:

Old version

Older version, still maintained

Latest version

Support[edit]

SQL CE databases can support ACID-compliance, but do not meet the durability requirement by default because AutoFlush buffers changes in memory (including enlisted ambient transactions and explicit SQL CE transactions that do not override the Commit() call with an CommitMode.Immediate value). Therefore, committed transaction changes can be lost. To meet the durability requirement the commit call on the transaction must specify the immediate flag.[13] Like Microsoft SQL Server, SQL CE supports transactions, referential integrity constraints, locking as well as multiple connections to the database store.[4] However, nested transactions are not supported, even though parallel transactions (on different tables) are.[14] The current release does not support stored procedures[4] or native XML data type either.[5] It uses a subset of T-SQL[2] for querying and due to lack of XML support, XQuery is not supported either.[5] Queries are processed by an optimizing query processor.[15] SQL CE databases also support indexing, as well as support remote data replication (local caching of data in remote databases) and merge replication (bidirectional synchronization with master databases).[16]

SQL CE databases can be created and managed from Microsoft Visual Studio and some older versions of SQL Server Management Studio as well.[15]

File format[edit]

SQL Server Compact

Filename extension

.sdf

Developed by Microsoft
Type of format Relational database

SQL CE databases reside in a single .sdf file,[17] which can be up to 4 GB in size.[4] The .sdf file can be encrypted with 128-bit encryption for data security.[17] SQL CE runtime mediates concurrent multi-user access to the .sdf file. The .sdf file can simply be copied to the destination system for deployment, or be deployed through ClickOnce. SQL CE runtime has support for DataDirectories.[6] Applications using an SQL CE database need not specify the entire path to an .sdf file in the ADO.NET connection string, rather it can be specified as |DataDirectory|<database_name>.sdf, defining the data directory (where the .sdf database file resides) being defined in the assembly manifest for the application.[citation needed]

SQL Server Management Studio 2005 can read and modify CE 3.0 and 3.1 database files (with the latest service pack), but SQL Server Management Studio 2008 (or later) is required to read version 3.5 files. Microsoft Visual Studio Express 2008 SP1 can create, modify, and query CE 3.5 SP1 database files. SQL Server Management Studio cannot read CE 4.0 files. Visual Studio 2010 SP1 can handle CE 4.0 database files.[citation needed]

The .sdf («Sqlce Database File») naming convention is optional, and any extension can be used.[citation needed]

Setting a password for the database file is optional. The database can be compressed and repaired with the option of the compacted/repaired database to be placed into a new database file.[citation needed]

Deprecation[edit]

In February 2013, Microsoft announced that SQL Server Compact Edition had been deprecated.[18]

Although no new versions or updates are planned, Microsoft will continue to support SQL Compact through their standard lifecycle support policy. Extended support for SQL Server Compact 4.0 ended on July 13, 2021.[19]

See also[edit]

  • Mobile database
  • SQLite
  • SQL Server Express § LocalDB
  • Access Database Engine (ACE and formerly JET)
  • HSQLDB
  • Firebird

References[edit]

  1. ^ a b «Microsoft SQL Server Compact 4.0 is available for download and use with WebMatrix». Retrieved 2020-03-11.
  2. ^ a b c d e «SQL Server 2005 Compact Edition Datasheet». Archived from the original on 2007-03-16. Retrieved 2007-07-03.
  3. ^ a b «Microsoft SQL Server Compact 4.0». Lifecycle. Microsoft Docs. Retrieved 2021-02-26.
  4. ^ a b c d «A Lap Around SQL Server 2005 Compact Edition». Retrieved 2005-07-03.
  5. ^ a b c d «SQL Server Everywhere: Just Another Database?». Retrieved 2007-07-03.
  6. ^ a b «What’s New (SQL Server Compact Edition)». Retrieved 2007-07-03.
  7. ^ «How do i run SQL Server Compact 3.5 on Windows 8 developer preview?». social.msdn.microsoft.com. Retrieved 11 March 2013.
  8. ^ «Microsoft Launches SQL Server 2000 Windows CE Edition at PASS 2000». news.microsoft.com. 2000-10-26. Retrieved 2022-04-16.
  9. ^ «Microsoft Delivers Support for Embedded Devices With Release of SQL Server 2000 Windows CE Edition Version 1.1». news.microsoft.com. 2001-03-21. Retrieved 2022-04-16.
  10. ^ «Microsoft Delivers Next Stage of .NET Solution For Enterprise Mobile Development». news.microsoft.com. 2002-09-16. Retrieved 2022-04-16.
  11. ^ «Microsoft SQL Server 2005». Lifecycle. Microsoft Docs. Retrieved 2021-02-26.
  12. ^ «Microsoft SQL Server Compact 3.5». Lifecycle. Microsoft Docs. Retrieved 2021-02-26.
  13. ^ «Maintaining Databases (SQL Server Compact Edition)».
  14. ^ «Transactions (SQL Server Compact Edition)». Retrieved 2007-07-03.
  15. ^ a b «Overview of Databases (SQL Server Compact Edition)». Retrieved 2007-07-03.
  16. ^ «Overview of Databases (SQL Server Compact Edition)». Retrieved 2007-07-03.
  17. ^ a b «Data Storage Architecture with SQL Server 2005 Compact Edition». Retrieved 2007-07-03.
  18. ^ Barranis, Patrick (2013-01-11). «Port SQL Compact to Windows RT». Microsoft Connect. Retrieved 2016-06-25.
  19. ^ «Microsoft SQL Server Compact 4.0 Support Dates». Retrieved 2020-09-17.

External links[edit]

  • SQL Server Compact 3.5
  • SQL Server Compact Release Versions
  • Microsoft’s Embedded Database — SQL Server Compact — Team Blog

В этой статье я опишу упрощенный подход к частному развертыванию SQL Server Compact, а обзорную публикацию в блоге о частном развертывании с SQL Server Compact см. В моем  блоге здесь .

Заставляя ваше приложение работать с использованием x86 всегда (предпочтительно 32-разрядного), который является новым целевым параметром Platform для приложений, нацеленных на .NET Framework 4.5, развертывание SQL Server Compact с вашим приложением становится проще, но оно должно следовать другим рекомендациям, чем Я ранее писал о. (Тот же подход будет работать и с приложениями, ориентированными на .NET 4.0, просто установите целевую платформу на x86 в указанном ниже месте. И тот же подход будет работать и с DLL-файлами SQL Server Compact 3.5.)

образ

Чтобы узнать больше о новой целевой опции платформы по умолчанию, представленной в .NET 4.5, см.  Документацию MSDN  здесь и пост в  блоге здесь .

Кроме того, я покажу, как использовать LINQ to SQL с SQL Server Compact 4.0, с низкими издержками и быстродействующим ORM.

Для простоты и для того, чтобы сосредоточить внимание на аспектах частного развертывания, я продемонстрирую на консольном приложении, но тот же подход будет работать и для приложений WinForms и WPF.

Прежде чем начать, убедитесь, что у вас установлено следующее:

1: Visual Studio 2010/2012/2013 Pro или выше 

2: надстройка SQL Server Compact Toolbox (установка через инструменты / расширения в VS)

3: Существующий файл базы данных SQL Server Compact, я буду использовать Chinook, который вы можете  скачать здесь

4. Среда выполнения SQL Server Compact  4.0 с пакетом обновления 1 (SP1)

(Вы также можете использовать бесплатную Visual Studio 2010/2012/2013 для Windows Desktop с автономной SQL Server Compact Toolbox для 4.0, которая также поддерживает генерацию кода LINQ to SQL)

После этого давайте откроем Visual Studio и начнем:

Создать новое консольное приложение

Перейдите в Файл, Новый проект и создайте новое консольное приложение Windows. Обязательно установите целевую платформу на 4.0 или новее.

образ

Включите двоичные файлы SQL Server Compact в свой проект

Теперь включите двоичные файлы SQL Server Compact 4.0 и ADO.NET Provider в свое содержимое. Скопируйте C: Program Files (x86) Microsoft SQL Server Compact Edition v4.0 Private System.Data.SqlServerCe.dll в папку проекта, а затем скопируйте все файлы и папки в C: Program Files (x86). Microsoft SQL Server Compact Edition v4.0 Private x86 также в папку вашего проекта.

В обозревателе решений выберите Показать все файлы и включите новую папку и семь файлов, только что скопированных в проект:

образ

Теперь отметьте все скопированные файлы (также файлы в папке Microsoft.VC9.CRT) и отметьте их как «Содержимое, всегда копировать»:

образ

Наконец, добавьте ссылку на файл System.Data.SqlServerCe.dll в папке вашего проекта:

образ

(Обязательно проверьте местоположение файла и версию, должна быть 4.0.0.1)

Добавьте файл вашей базы данных в проект

Убедитесь, что это также содержимое, всегда копируйте — здесь мы используем рабочий процесс «Сначала база данных».

Создайте LINQ to SQL DataContext

Далее мы создадим класс LINQ to SQL DataContext и связанные с ним классы таблиц на основе базы данных, поэтому подключитесь к базе данных в SQL Server Compact Toolbox, используя пункт меню Добавить соединение SQL Server Compact 4.0:

образ

Затем щелкните правой кнопкой мыши базу данных и выберите «Добавить LINQ to SQL DataContext в текущий проект»:

образ

(Я просто использую ChinookContext в качестве имени контекста)

Нажмите кнопку ОК, и файл класса DataContext будет добавлен в ваш проект, а в проект будет добавлена ​​необходимая ссылка на System.Data.Linq.

Теперь давайте добавим некоторый тестовый код в метод Main, чтобы убедиться, что все работает до сих пор, поэтому код Program.cs выглядит следующим образом:

using System;
using System.Data.SqlServerCe;

namespace LinqToSqlCePrivateDeploy
{
    class Program
    {
        private const string 
            dbFileName = "Chinook_SqlServerCompact_AutoIncrementPKs.sdf";
        
        private static string dbConnectionString = 
            string.Format("Data Source=|DataDirectory|{0};Max Database Size=4091", dbFileName);
        static void Main(string[] args)
        {
            using (var connection = 
                new SqlCeConnection(dbConnectionString))
            {
                using (var context = new ChinookContext(connection))
                {
                    //To log SQL statements, use:
                    //context.Log = Console.Out;
                    foreach (var album in context.Album)
                    {
                        Console.WriteLine(album.Artist.Name);
                        Console.WriteLine(album.Title);
                    }
                }
            }
            Console.Read();
        }
    }
}

Теперь мы можем получить доступ к базе данных через сгенерированную объектную модель, и нам не нужно вводить SQL, но мы можем использовать LINQ для запроса к базе данных. Кроме того, мы можем обновить базу данных (INSERT, UPDATE, DELETE) с помощью методов в DataContext. 

Обратите внимание, что DataContext  должен  быть создан с помощью объекта SqlCeConnection, чтобы LINQ to SQL мог работать с SQL Server Compact 4.0. 

Развернуть файл базы данных 

Последний шаг будет сделан, чтобы гарантировать, что файл базы данных будет расположен в доступной для записи папке на компьютере пользователя при развертывании / установке. Мы просто сделаем это в коде, чтобы не зависеть от действий и проблем при установке. Кроме того, мы можем сделать это без сохранения каких-либо строк подключения в app.config, что делает приложение более автономным. Мы будем использовать тот же подход, который я уже использовал в своем  блоге,  который использует макрос строки подключения DataDirectory.

private static void CreateIfNotExists(string fileName)
{
    string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
    // Set the data directory to the users %AppData% folder 
    // So the database file will be placed in: C:\Users\<Username>\AppData\Roaming\ 
    AppDomain.CurrentDomain.SetData("DataDirectory", path);
            
    // Enure that the database file is present
    if (!System.IO.File.Exists(System.IO.Path.Combine(path, fileName)))
    {
        //Get path to our .exe, which also has a copy of the database file
        var exePath = System.IO.Path.GetDirectoryName(
            new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);
        //Copy the file from the .exe location to the %AppData% folder
        System.IO.File.Copy(
            System.IO.Path.Combine(exePath, fileName), 
            System.IO.Path.Combine(path, fileName));
    }
}

Не забудьте добавить вызов CreateIfNotExists в качестве первой строки в методе Main:

static void Main(string[] args)
{
    CreateIfNotExists(dbFileName);

Теперь вы можете использовать ClickOnce, XCopy или Installer для развертывания приложения без каких-либо других требований, кроме целевой версии .NET Framework.

Чего мы достигли:

— Простое автономное развертывание однопользовательского настольного приложения любого типа на любой платформе .NET 4.0 или более поздней версии (но не ARM)

— Нет необходимости в специальных заклинаниях в app.config

— RAD (Rapid App Development) «Database First» доступ к хорошо работающей, хорошо документированной и простой ORM.

Вы можете скачать полное решение здесь; http://sdrv.ms/179QBaa


Chocolatey Community Coffee Break

Join the Chocolatey Team on our regular monthly stream where we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.


Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You’ll have a chance to have your questions answered in a live Ask Me Anything format.


Announcing Chocolatey Central Management 0.10.0

Livestream from
Thursday, 06 October 2022

We recently released our largest update to Chocolatey Central Management so far. Join Gary and Steph to find out more about Chocolatey Central Management and the new features and fixes we’ve added to this release.

Watch On-Demand


Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand


Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand


The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We’ll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand


Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand


Chocolatey Product Spotlight: Chocolatey 1.2.0 and Chocolatey Licensed Extension 5.0.0

Livestream from
Thursday, 03 November 2022

Join Paul and Gary for this months Chocolatey product livestream where we look at the latest release of Chocolatey 1.2.0, Chocolatey Licensed Extension 5.0.0 and shine a spotlight on the new hook scripts functionality. This opens up so many possibilities for Chocolatey CLI users!

Watch On-Demand


Chocolatey Coding Livestream

Livestream from
Tuesday, 29 November 2022

Join Josh as he adds the ability to manage Chocolatey GUI config and features with the Chocolatey Ansible Collection.

Watch On-Demand


Introduction into Chocolatey with Veeam

Webinar from
Tuesday, 13 December 2022

Join Gary, Paul, and Maurice as they introduce and demonstrate how to use Chocolatey! Questions will be answered live in an Ask Me Anything format.

Watch On-Demand


Понравилась статья? Поделить с друзьями:
  • Sql server authentication connection string windows authentication
  • Sql server 2019 скачать для windows 10 x64
  • Sql server 2018 скачать для windows 10
  • Sql server 2017 express скачать для windows 10 x64
  • Sql server 2017 express windows 2008 r2