Creating SQL CE4 databases - visual-studio

I've downloaded the RTM version of SQL CE (Compact Edition) and installed it. I've installed the SQL Server Compact Toolbox. I understand that SQL CE4 support within Visual Studio won't happen until SP1 drops.
The problem is, while I have tools to edit the CE Database, I can't find a way to actually create a SQL CE4 database. I figure I must be missing something obvious, but 20 minutes of searching hasn't turned up anything. How do I create a SQL CE4 database?
Thanks,
Erick
Edit: I would rather avoid installing and running WebMatrix.

The SQL Server Compact Toolbox also allows you to create a database file (via the Add Connection dialog)

There's probably a better solution, but you could try out WebMatrix. With it I created an Orchard site, but after creating the site you can create new databases by clicking the 'New Database' button.
Really easy. Don't think this is the best option though...

Related

Is there a model browser window for LINQ to SQL?

I'm looking for a way to list the tables/objects in a LINQ to SQL model, and search them, similar to the Model Browser window for Entity Framework.
Are you using MS SQL Server? If so you should be able to use the Database Diagrams.
It turns out that in Visual Studio 2017 the model browser can be activated by pressing Ctrl+1 if the edmx diagram is displayed at the same time.
For a work-around, I'm editing the *.dbml file directly. However, this seems much more error prone (copy-paste errors, requires more knowledge of framework, etc.), for repetitive changes.
UPDATE (and actual fix):
I had to install SQL Server Data Tools (SSDT) for my specific version of Visual Studio. This doesn't have to match your target version of SQL Server.
See here for Visual Studio 2017:
https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017
Note that using the standalone installer did NOT work for this purpose (LINQ to SQL model browser). Only using the Visual Studio installer, and after a restart did the browser load.
I didn't update this answer immediately, so there may be something I'm missing; please add more detail if you encounter this issue.

VS 2013 Query Designer greyed out

I believe I am following the instructions at http://msdn.microsoft.com/en-us/library/vstudio/ms171960.aspx but whatever I try, the Query Designer toolbar remains greyed out and 'Query Designer' does not appear in the main menu. Am I missing something?
(VS2013 version 12.0.21005.1 REL connecting to a SQL 2008 R2 Express db)
Have posted similar problem here - Solved on this thread.
Create two connections in VS Server Explorer.
1) Microsoft SQL Server Database File (SqlClient):
Use this for editing tables, and for the connection string in the software.
2) Microsoft SQL Server + .NET Framework Data Provider for OLE DB:
Use this for visual queries.
Everything is VS, Publish options don't give 'file in use'.
On a completely unrelated Twilight Zone moment - you posted the same question, on the same day, on the same forum, and both our names are Peter G!

Is it possible to use Windows Authentication to connect to a SQL Express db?

I've been looking around to find an answer to this question, and seeing lots of different answers, some of which don't look right to me. Here's my problem.
I've created a SQL Server 2008 Express database, and populated it with tables from 2 regular SQL Server databases (it's to receive data from the 2 databases). I've done this using Windows Authentication.
Now I want to test deploying an app, as a ClickOnce application, so I've written a bare-bones console app in VS 2010. Next I tried to add a new data source to the SQL Express 2008 database. But when I try to do that I get a message saying, "This file is in use. Enter a new name of close the file that's open in another program." (I'm running VS 2010 as an administrator on my Windows 7 Ultimate box, which was one of the answers someone gave to fix this problem, but isn't working for me.) I don't have the SQL Express db open in SSMS or anything else. One solution I've read is to get into SSMS and detach the .mdf, but then how would I do maintenance, like create new SP's, views, etc? Is it a maintenance nightmare of attaching in SSMS while not in VS 2010, do DBA work, then detach the DB, get into VS 2010 do work, etc?
The database is meant to run on the user's machine; not a network share.

How do I open a SQL CE4 .sdf database file?

I installed Microsoft WebMatrix, which, I believe comes with SQL Server CE4. I've tried opening the SDF file in SQL Management Studio (SQL 2008), but I get the following error message:
-------- Microsoft SQL Server Management Studio:
There is no editor available for
'C:\efTest\App_Data\SchoolRepository.sdf'.
Make sure the application for the file
type (.sdf) is installed.
How do I view/modify my .sdf database?
I see there is a similar question on StackOverflow (http://stackoverflow.com/questions/4070860/sql-compact-4-0-cant-open-read-sdf-file) but I would really like to use Management Studio if I can, and not another 3rd party tool.
Have you tried the SQL Server Compact Toolbox?
or the SQL Compact Query Analyzer?
You can download sql ce through web api just follow this link
visual-studio-tools-for-sql-serverl
to do that.
Here are a couple which have worked quite well for me in terms of connecting to SQL CE 3.5 and 4.0 databases:
LINQPad - (See my remark to question) It works quite well plus it allows for specifying LINQ or SQL for queries.
CompactView - Seems pretty full featured + install creates a nice Windows file association so one can simply double-click to open/connect to .sdf files for instance.
All of the other options require SQL CE 4.0 Database Provider installed on your machine.
This one doesn't need provider http://sqlcequery.codeplex.com/
If you are using Visual Studio 2015, 2013, 2012, 2010, try SqlCeToolbox.4.5.0.3.vsix. It is SQL Server Compact/SQLite Toolbox for Visual Studio.
The link:
http://www.sokhawin.com/how-to-open-sql-compact-edition-file-sdf-in-visual-studio-or-linqpad/
It has ability to open and edit.

Database Diagramming Tools for SQL Server CE 4

Although there are GUI tools in VS2010 for entering data, writing queries etc against a SQL CE4 db, there doesn't appear to be a way to visualise the database in a digram.
So my Questions are
A) Have i missed something in VS2010 tools for sql Server CE4
b) Can i use SMSS to Diagram SQL CE4 databases. I've tried it but it wouldn't allow open the db. Is there a plugin available?
Thank you.
Microsoft does not supply a diagramming tool for SQL Server Compact 4, you could try my VS 2010 add-in http://sqlcetoolbox.codeplex.com (Create Database Graph) or the Data Port Console from http://www.primeworks-mobile.com
Actually, there IS a diagramming tool for SQL CE right into VS, but it's hard to find.
I only tried this in VS 2012 Preview, but it might work in older versions - please speak up in the comments.
Here's how to get to it:
In 'server explorer' create a normal connection to the SQL CE database. (No diagramming options are visible...)
Then right-click a table -> "Show table data"... Wait for it...
Hit Ctrl-1.
TA-DA!!
Alternatively, Right-click in the window with the tabular data and choose "Pane" from the context menu. (I know, 'Pane' !?)
Finally, from the 'Pane' submenu click the obvious choice - "Diagram".
There you have it.
SDF Viewer is now able to create database diagrams for SQLCE databases

Resources