How to upgrade SQLCE from 3.1 to 3.5 - c#

In the previous project, I've already developed an application with Ms Visual Studio 2005 and use SQLCE 3.1. Now, I have to add some feature there. Today I want to use SQLCE 2008(3.5). my sdf file still didnt work.
How do I upgrade it?
my error:
{"The database file has been created by an earlier version of SQL
Server Compact. Please upgrade using SqlCeEngine.Upgrade() method."}
I already tried and get some source in here and here, but it still doesn't work.
What should I do?
Must I downgrade my VS and DB or have another way to do it?
#joshua
of course i already try it, but the error message still like before i put it there. the output still detail:
unhandeled exception has occured in your application. if you click
continue. the application will ignore this error and attempt to
continue". if you click quit, the application will close immidiately
the databe file has been created by an earlier version of SQL server
compact. please upgrade using SqlCeEngine.Upgrader() method it still
display.
what should i do now?

I hate to ask it like this, but did you try calling the SqlCeEngine.Upgrade() method like the error message stated. That method is supposed to upgrade the SDF file from SQLCE 3.1 to SQLCE 3.5.
It should work like this:
SqlCeEngine engine = new SqlCeEngine("Data Source=data.sdf");
engine.Upgrade();

Related

Entity Framework Database First generation crash MYSQL

I am trying to generate code from an existing MySql database.
I'm following this guide: https://msdn.microsoft.com/en-us/library/jj206878(v=vs.113).aspx
When I select the database from my data connections the wizard just disappears. I have read something about this being caused by MySql NuGet packages version mismatch, but I seem to have the correct versions. These are my installed NuGet packages.
Also, I see a lot of mention of "Connector/Net" can someone tell me what that is?
The wizard closing is a known bug in MySQL Connector/NET:
Bug 89338 for 6.10.5
Bug 91195 for 8.0.11
You will need to wait for Oracle to fix this bug and ship an update. Some people have reported being able to work around the problem by following these instructions.
"Connector/NET" is just another name for the MySql.Data library plus the additional Visual Studio addins; for example, it's used in this documentation.

LoadPackage fails from .NET with Integration Services class cannot be found

I know this has been asked many times before but I haven't found a solution to my specific problem.
My setup is a newly installed Windows 10 Enterprise fully updated with SQL Server 2017 incl Integration Service and Analysis Service. I've installed latest SSDT as well. I've also installed client tools SDK from the SQL Server 2017 installation.
Visual Studio 2017 is installed as well.
My ASP.NET application 'should be' running SSIS packages, but it fails when loading the package using LoadPackage(packageName, null).
The error is "an integration services class cannot be found etc etc.....".
Just to repeat - Integration Service 2017 and Client Tools SDK are installed.
My application has been working on previous SQL Server versions - the most recent version is with SQL Server 2014, but I've upgraded my application from SQL Server 2008 to 2008R2 to 2012 to 2014 and I've never met problems before.
What is different from other posts I can find is that I do not deploy the SSIS package to a separate web server (well, I do and that doesn't work either but a first step is to solve it on my dev machine).
I have created an empty SSIS package in VS2017 to ensure it is not the content of the package that causes the error.
The SSIS package is developed on the same machine, and I can run the package with both 32 and 64 bit versions of DTExec.exe successfully.
I have updated any references in my ASP.NET application to ManagedDTS.dll version 14.0.
I've updated my ASP.NET application to .NET 4.7 as part of this update to SQL Server 2017.
As I can easily search and find many posts about similar problems with lots of solution suggestions, I hope someone will reply to this with solution suggestions rather than links to 'copies' of my question, as chances are I've already read those and tried all suggested solutions.
Thanks in advance...
UPDATE:
First of all, creating a new project and loading a package works - so I figured that I might be facing a problem with the code after updating from .NET 3.5 to 4.7.
I started commenting code and found that if I don't do impersonation before calling LoadPackage, it actually works.
Based on some other issues I've had recently with the July updates from Microsoft, I have removed one of the updates and I now get a different error - with the impersonation code enabled.
The current error is one I've seen many other people have so I'll dig into that - it is: "The package failed to load due to error 0x80131534 \"(null)\". This occurs when CPackage::LoadFromXML fails.\r\n".
I don't really understand if this should be caused by a mismatch between versions, but I'll update as I find out more.
If anyone has good suggestions, I'd be happy to hear them :)
As a quick WORKAROUND, you can set sql job calling the ssis package and run the job using the sp_start_job stored procedure from the asp.net app.
If the running job needs to be monitored, status can be checked using:
select * FROM msdb.dbo.sysjobactivity

Use VS2013 to browse localdb

I am trying to follow along with this article (EF Code First) and whilst the code runs and the output is what I expect, I can't browse to my LocalDb from within VS2013. I see my SQL Server 2012 developer instance but not my LocalDb. I can't find my .mdf file either.
The post says I should see the database in SQL Server Object Explorer, but I can't, and it doesn't seem obvious how to add it. I know I have SQL Server 2012 installed, and some of my project require it, but to get the most from the article I'd like to be able to follow along exactly.
Any ideas how I can see my project database file from VS2013?
Jason.

Can't use SQL Server CE in VS2012

I'm developing a web application and was trying to use a local database file to store some information. However, when I add the .sdf file, I get an error. Below are some screenshots detailing my problem.
I've been trying to figure what's wrong for several hours. I've seen similar issues, but have yet to find a fix. I used to be able to use SqlServerCe connections before with .sdf files, though that was a different development environment. I have tried reinstalling everything SQL several times, including downloading everything I could find on MSDN. Can anyone help me out?
Below is my Solution Explorer View. I've just added Database1.sdf to the project.
I get an error as soon as I add it:
If I try to open the .sdf file, I get this error:
Here is my list of references:
And, finally, all of the relevant SQL-related installations on my local machine:
SQL Server Compact 4.0 is supported by VS 2012, but requires the DDEX provider to be properly isntalled. Sounds like your VS install is somehow broken. You can install my Toolbox add-in, and go to the About dialog in the Toolbox to check if the DDEX provider and SQL Server CE 4.0 is properly installed.

SQL Server CE distribution

I have spent several days trying to solve this problem with no luck and my requirements are really simple - I want to make an application with database which will work on most PCs (without DB server installed) and I want to use LINQ. For the compatibility reasons I want to use .NET framework 3.5 (every Windows 7 machine has it).
I have tried 2 ways: SQL Server CE and SQLite.
SQL Server CE
Although Visual Studio does not support LINQ for Compact Version of SQL server, I have found simple workaround - generating .dbml file using metal.exe tool from Visual Studio and then dragging it into project. My application works fine on my machine, but when I copy it somewhere else, it crashes. I have copied all dlls from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\3.5 and tried 4.0 too. I think problem is that my app is not looking for dlls (references) inside its directory. I managed to get it work using DataSets (without LINQ), where I manually add reference to SQLServerCE and check CopyLocal to true. BUT when I use LINQ, there is no reference to SQLServerCE in project references and it is working. I don't know how to change it. Or is there a problem somewhere else?
SQLite
After long messing with SQL Server CE, I have tried SQLite. I am very disappointed how poor is SQLite support in .NET. I had to download older version of ADO.NET provider (newer versions does not add SQLite Database into my Visual Studio 2010 - I don't understand why but I googled that it is normal and I have to install old version and then replace it with newer). Then I downloaded dblinq (I have discovered that this project is dead later) and after some messing with dbmetal and dlls I get rid of errors in Visual Studio and compiled my application. But I can't run it, it always crashes on error 40 - like there was no SQLite server. Of course I have copied all dlls. I can't run it even on my development machine.
I am very surprised that it is nearly impossible to create simple database application in C# .NET which will not bother client with servers etc.
Please is there anyone who made SQL CE work with LINQ and mainly who made his app distributable?
I would suggest you try using the nuget Entity Framework for SQL CE package. It will download all the required assemblies to make it work.
http://nuget.org/packages/EntityFramework.SqlServerCompact/

Categories