Can't use SQL Server CE in VS2012 - c#

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.

Related

asp.net application not connecting to oracle 11g even after installing oracle instant client for 11g

I have a asp.net mvc application which is using oracle 11g database. In development machine every thing worked fine, but while deploying it in production server asp.net application is not able to connect to the database server. It is always throwing an empty exception.
I wrote also a simple console application to test the db connectivity. It is also not working. Then I realized it is because that the machine doesn't have a oracle client installed. so I installed Oracle instant client for 11g database 32 bit version. After this the console application started working but the web application still could not connect.
I google lot and finally decided to analyse using process monitor. In process monitor I found that the web application (iis) is looking for an oraclient12.dll.
This oraclient12.dll is part of oracle client for 12c database. I can't understand why it is looking for this dll.
After installing oracle database client for 12g, the above issue with oraclient12.dll got fixed. but iis is now not able to locate oraclsce12.dll.
I searched the whole file-system for this file but could not find.
does anyone know what should i install to get oraclsce12.dll.
Thanks,
Sujith
I was facing similar issue, then came to know that for the dll to be installed you should now also install the option «Oracle Advanced Security»,, by choosing custom installation when installing the oracle 12 client. I did the same and my issue got resolved. You can try this and see if your issue gets resolved.
thanks Sudharsan
This is documented as Oracle bug 17379890.
Oracle provides two workarounds:
Workarounds include:
To avoid the issue in the first place, explicitly select "Oracle NET" component during install
After the fact, you can
do another custom install into the same home, and select "Oracle NET"
copying ORACLSCE12.DLL from an existing install into OH\bin also resolves the issue.
However, making a single copy of file ORACLSCE12.DLL is not sufficient because there are more files which are missing. The workaround works only for certain applications. For example for tnsping.exe you still get an error due to missing files.
You have to take the first solution, i.e. explicitly select "Oracle NET" component during install

Visual Studio How to Publish Application that uses data from an Online Database

Hi I published my desktop application on visual studio as a clickOnce installation but I seem to have problems with SQL and Entity Framework Exceptions as this is what my software uses in order to display data. Is there any other way to get around this problem ? Here is an image of what happens when the user wants to see the specific data. Mostly the Exceptions range from both SQL and Entity Frameworks. This only happens upon another computer and not mine which the Software was created on.
Any help would be greatly appreciated !
If you wish to deploy your database with the application binaries then you can try SQL Server Compact instead of the full version of the server, which requires the server to be installed on the machine. The msdn link here will help you with the process -
http://msdn.microsoft.com/en-us/library/aa983326(v=vs.110).aspx
and you can download the application from here -
http://www.microsoft.com/en-us/download/details.aspx?id=17876
In short, SQL Server Compact databases files (.sdf) can be deployed along with your application and some binaries and dlls to help it work on the destination. The msdn topic will show you how to do this.
The full documentation and a good starting point is here too -
http://msdn.microsoft.com/en-us/library/aa983321(v=vs.110).aspx
IMPORTANT Entity framework has some limitations when working SQL Compact Databases, make sure you check and see that this won't be a problem for you.
http://technet.microsoft.com/en-us/library/cc835494(v=sql.110).aspx

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 get data out of .mdf file

I created a project a while ago and transferred it to my other computer, and now it's stopped working. I can't manage to fill the grid with the data from the .mdf.
I have struggled a while with this problem and I can't manage to solve it. I would appreciate if someone here could download the .rar and help me solve this problem.
http://www.filefactory.com/file/3wabxfsyxign/n/CDapplikation_uppgift_rar
.mdf are SQL Server data files; for working with those files, you must have some version (other than Compact Edition) of SQL Server installed
So to get this data out:
check to see what version of SQL Server you have installed
fire up the management tool, e.g. SQL Server Management Studio (possibly the Express version which you can find by searching on Google or Bing and download for free from Microsoft)
attach the .mdf file to the SQL Server under a logical name, so that you can use it
now you can access it using raw ADO.NET or Entity Framework or whatever other data access technology you wish to use

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