Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9254995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:36:42+00:00 2026-06-18T11:36:42+00:00

I have a wpf application that accesses data within a SQL Server CE database.

  • 0

I have a wpf application that accesses data within a SQL Server CE database. The application and database are meant to be run on a PC without installation, however attempting to do so fails. (failure to locate db provider) I’ve taken the following steps:

  • System.Data.SqlServerCE -> copy local
  • copied 7 SQL Server CE assemblies into application directory
  • verified that VC++ is available on system
  • added following to app.config

    <system.data>
      <DbProviderFactories>
        <remove invariant="System.Data.SqlServerCe.4.0" />
        <add name="Microsoft SQL Server Compact Data Provider 4.0" 
             invariant="System.Data.SqlServerCe.4.0" 
             description=".NET Framework Data Provider for Microsoft SQL Server Compact" 
             type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </DbProviderFactories>                          
    </system.data>
    

On attempted execution of the following code:

  try
  {
    MessageBox.Show("initialize db connection");
    context = new DataAccess.PersistentStorageEntities();
    MessageBox.Show(context.Database.Connection.ConnectionString);
  }
  catch (Exception ex)
  {
    MessageBox.Show("exception: "+ex.Message);
    if (ex.InnerException != null)
    {
      MessageBox.Show("innerexception: "+ ex.InnerException.Message);  
    }
  }

I get the message:

exception: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

I suspect it’s having trouble loading the System.Data.SqlServerCe.4.0 , but can’t figure out why it would be trying to load as Win32

Any thoughts? I feel like I’m losing my mind here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:36:43+00:00Added an answer on June 18, 2026 at 11:36 am

    1: You must use the System.Data.SqlServerCe dll from the Private folder (and the System.Data.SqlServerCe.Entity.dll dll from the same folder).

    2: You must add x86 and AMD64 folders to your project, and include the required files (including the private VC++ runtime folder) in each (like in the Private folder). Make sure to include all files as content

    3: You must change the config reference to version 4.0.0.1

    See my blog for more detailed info: “Using SQL Server Compact 4.0 with Desktop Private Deployment and a Setup project (MSI) (part 2)”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an internal WPF client application that accesses a database. The application is
I have a WPF application that directly communicates with a MS SQL 2008 database.
Please help! Background info I have a WPF application which accesses a SQL Server
I have a wpf application that saves items in a SQL Server Compact Edition
I have a WPF application that will always run on windows 7, it opens
I have a WPF application that at start up inits a named pipe server
Basically I have a WPF application that will display announcements to the user within
I have a WPF application that I hope can spin off two data-research background
I have a WPF application that uses MVVM data bindings. I am adding items
I have a WPF client application that connects to IIS that hosts WCF Data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.