How can I determine what version SQL Server Compact a table is? - visual-studio-2010

I have some .SDF tables that are created in a Windows CE app (access table data is passed from a server app, and this is converted into SQL Server Compact records/tables).
I want to look inside them from my desktop machine in Visual Studio 2010. But attempting to create a new Data Connection in the Server Explorer, selecting either of the two "Microsoft SQL Server Compact" Data sources (3.5 and 4.0) fails.
When I choose 3.5 and then "Test Connection," it tells me:
This is not a valid SQL Server Compact Database file or this file version is not supported by current SQL Server Compact Engine.
When I choose 4.0 and then "Test Connection," it tells me:
Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 0, Requested version = 0,File name = MyRecalcitrantTable.SDF
Is there a way to make a connection to these tables so I can query them to see what they contain? How can I determine which version they were created with (apparently prior to 3.5) so that I can possibly use an earlier version of VS to view them (or some other tool?)

You can use my SQL Server Compact Toolbox VS extension, it has a Detect file version feature, but they are probably version 2.0 files, and can only be opened on a Windows ce device (or emulator)

Related

Oracle Data provider for .NET in visual studio

Newbi to oracle and its versions and .NET providers, but did some investigation.
I'm trying to add Oracle connection to the visual studio server Explorer (before setting up the Entity Framework 6 for oracle).
System preferences:
Windows 10 enterprise - 64 bit operating system
Visual Studio 2015
Oracle Data Access Components (ODAC) which includes Oracle developer Tools for Visual Studio: ODAC12C - 12.2.0.1 - it is suitable to 64 bit !
The DB is located in a remote machine and I can see the DB objects using the Oracle SQL developer. It uses the TNSNames file to locate the DBs.
when trying to "add connection" in the visual studio server explorer:
Select Data Source: Oracle DataBase
Data Provider:.NET framework data provider for Oracle.
It claims that:
"This provider is deprecated and should not be used. Instead download
Oracle Developer tools for visual studio for comprehensive integration
with Oracle database."
The problem is that the mentioned above reference links to a 32-bit Oracle Data Access Components (ODAC) bundle which includes "Oracle Developer Tools for Visual Studio". The same shXX happens when choosing .NET framework data provider for OLEDB.
Either I don't see the relevant provider in the list or there is a problem.
After inserting Server name, User name and Password in the "Add connection" dialog box, I get this error message:
"Attempt to load Oracle Client libraries threw BadImageFormatException.
This problem will occur when running 64 bit mode with the 32 bit Oracle Client components installed"
What am I doing wrong ?
Is this the way of defining connection string when I have a TNSNames file ?
Microsoft .NET Framework Data Provider for Oracle is different to Microsoft OLE DB Provider for Oracle which is different to Oracle Data Access (which can be Oracle Data Provider for .NET or Oracle Data Provider for .NET Managed Driver or Oracle Provider for OLE DB, depending on which one you installed), see How to connect to Oracle 11 database from . net
Visual Studio 2015 is 32-bit, when you like to connect to an Oracle database directly from Visual Studio Explorer then you have to download/install the 32-bit version of ODAC - and also install 32-bit Oracle Client.
In case you like to use also 64-bit Oracle Client and drivers follow this instruction: BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

Properly Install Oracle ODAC With ODT 11.2.3.20

Ok - I have VS 2012 and VS 2013 installed on a 32-bit developer machine running Windows 7 Enterprise and am attempting to connect to an Oracle 9 database. I can install version 12.1.0.24 without a problem, and I can connect to most databases using ODP.NET Managed and Unmanaged drivers through Server Data Connections tool, etc. Problem is that I also have to build applications that connect to legacy Oracle DB Server instances, and really need an older version of the VS Tools and ODP.NET / ODAC, ie 11.2.3.20. This seemingly installs correctly, but when you try to build a new data connection, the default Data Provider is ".NET Framework Data Provider for Oracle" There is an option for "Oracle Data Provider for .NET", but there is seemingly no way to specify a tnsnames.ora location, and the only option available in the "Data Source Name" combo is "(Local Database)."
Furthermore no option for picking Managed or Unmanaged for the Provider is available. Can somebody please tell me the proper thing to do to get this to work? Are there machine-wide configurations I have to make manually, that the installer for 12.1.0.24 does automatically?
Usually there is no need to install more than one Oracle Client (resp. one each for 32-bit and 64-bit). You can connect to older database with 12.1 client (for Managed Driver the Database must be 10.2 or newer).
Most likely you messed up your Oracle installation, remove them all and install one version from scratch.
In order to make you application independent from installed Oracle Client open *.csproj, resp. *.vbproj file and edit reference to ODP.NET like this:
<Reference Include="Oracle.DataAccess">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
Attributes like Version=... or processorArchitecture=... are not required. Your application will load the correct Oracle.DataAccess.dll depending on selected architecture and target .NET framework (provided that it is installed properly)
"Oracle.DataAccess" and "Oracle.ManagedDataAccess" are different assemblies, so you cannot use them seamless - unless you use DbProviderFactory and such stuff.

Can't add Local Database to project

This might be a really dumb question... but in VS2013 when trying to add a local database to my Windows Forms Application Project the option is now shown in the C# items menu. The only DB that is available is a Service-Based DB. From what I understand, this is related to SQL Compact Edition but I do have SQL Server 2012 installed. Any ideas? Or are there any significant differences between the Local DB and Service-Based DB?
A service-based database is a database that is only accessed through a server. It uses an MDF data file, which is SQL Server format. To be able to connect to a SQL Server database the SQL Server service must be running, because it's that that processes your requests and access the data file.
A local database is one that is local to your application only. It uses an SDF data file, which is SQL Server CE (Compact Edition) format. There is no need to install a server to access an SDF database. You simply distribute the DLLs that constitute SSCE along with your app and access the data file directly.
You'd normally only use SSCE if the data was to be accessed by your app only and there was a relatively small amount of data. For your project you would use SQL Server. For testing purposes you can use the free Express Edition. When deployed you might still use SSEE or you might use a full version of SQL Server. Note that Microsoft include SSEE with their own RMS POS software. SSEE is limited to databases of 4GB though, so even if you start out with SSEE and it can handle the load, you may still have to upgrade at some point in the future based on data capacity.
Source of info:jmcilhinney post.
for help on creating the database have a look at this tutorial it may be of some help.
Hope this info helps you :)
It turns out VS2013 dropped the .sdf format.
Is Microsoft dropping support for SDF database files in Visual Studio?
The answer is yes: Microsoft is silently dropping support (as usual IMHO) to Sql Compact Edition.
It started abandoning Sql CE 3.5 in Vs2012 It continued dropping Sql CE in Sql Management Studio 2012 and finally in VS2013
You can use CompactView or install SQL Server Compact Toolbox extension in VS2013 or (my prefered solution) use Sql management Studio 2008
UPDATE thanks to Nicolas' comment
As stated by Microsoft:
SQL Server compact edition is in deprecation mode with no new releases planned near future. Last release SQL CE 4.0SP1 (and earlier releases that are still in the support cycle) will continue to be supported through its lifecycle and Microsoft is committed to fix any major, production blocking issues found in these releases.
Have you tried adding your local database from inside the project? Have a look and see if you can add your database from datasources.

Visual Studio upgraded my database, now how do I convert it back.

I wanted to open my database up using sever explorer in visual studio 2012 and it told me I needed to upgrade my database from 3.5 to 4.0. Now when I deploy my application (WP8 project) it tells me Incompatible Database Version. If this was a compatible file, run repair. For other cases refer to documentation. [ Db version = 4000000,Requested version = 3505053,File name = mydatabase.sdf ]. How do I downgrade back to 3.5... I'm using VS2012 - surely if there was a quick upgrade like it did - there is a quick downgrade. :-)
I assume a backup wasn't created by the wizard. You could try using the SQL Server Compact Toolbox to downgrade from 4.0 to 3.5. There's a tutorial here on how to do it for SQL Server to 4/3.5 but it should be the same for CE 4 to 3.5. The idea is to export your database's information to a file that can then be used to create a 3.5 version of the database.
Before you try and downgrades, create a backup of the database just in case something else happens.

How can I connect to a SQL Server Compact 3.5 file as a data source in Visual Studio 2012?

Visual Studio 2012 comes with SQL Server Compact 4.0. I have installed SQL Server Compact 3.5 from http://www.microsoft.com/en-GB/download/confirmation.aspx?id=5783 However I still only have the option of making a new data connection to a SQL Server Compact 4.0 file, whereas the files I need to get data from are SQL Server Compact 3.5 files.
Is it possible to connect to a SQL Server Compact 3.5 file as a data source in Visual Studio 2012? If so which settings or installs should I need?
Over in a thread I started on SQL Server Developer Center > SQL Server Forums > SQL Server Compact Ray Chen has posted an answer:
Unfortunately, SQL Server CE 3.5 is not supported in VS 2012 indeed.
You have to upgrade the SQL Server CE 3.5 database to 4.0 as Erik
suggested [link added]. Also please take a look at this article: Visual Studio
2012
Compatibility.
In the section of ‘These Assets Need Your Attention’, it says: One-way
upgrade. You must upgrade these assets before you can open them in
Visual Studio 2012. After you upgrade, you won’t be able to open them
in previous versions. The following table lists the project types,
file types, and technologies that you must upgrade. And SQL Server CE
3.5 is included in the table.
I've posted a subsidiary question there to find out how, given that I cannot read in the file, I would convert it to SQL Server Compact 4.0.
=========== EDIT ==========
Ray Chen went on to post references to ErikEJ's blog post HOW TO: Upgrade a version 3.x database file to SQL Server Compact 4.0 and to the SqlCeEngine.Upgrade Method (String) library page.

Resources