How to know if Entity was using SQL Server or not? - asp.net

I have followed through a tutorial using a "Code First" approach with Entity framework. It seems like Visual Studio was smart enough to create the database for me and setup the tables and everything based on my classes. I have a question about the database that was created.
I notice that the database was automatically set up and I could see it in my Server Explorer window in Visual Studio. In my Web.config, under the connection string, I see Data Source=(localdb)\v11.0;.... There is also a .mdf file created in a folder called App_Data.
My question is:
Was Entity framework using MS SQL Server or SQL Express for the database it has created?
If it wasn't using MS SQL Server or SQL Express, what was the database that Entity used?
I don't remember installing SQL Server or SQL Express. Does installing Visual Studio automatically install MS SQL Server or SQL Server Express?
PS: I will appreciate if you can help me to clear up my doubts. Coming from a PHP background, I'm very new to .NET and its ecosystem.

The connection string indicate that you are using SQL Server Local DB.
With Microsoft SQL Server 2012, Microsoft has introduced a feature called LocalDB which is a new edition of SQL Express. LocalDB is created specifically for developers and it is much easier to install (no service) and manage than standard editions. Developers initiate a connection by using a special connection string. It supports AttachDbFileName property, which allows you to specify a database file location.
When connecting, the server is automatically created and started, enabling the application to use the database without complex configuration tasks. This edition uses the same sqlservr.exe as the regular SQL Express and other editions of SQL Server.
http://msdn.microsoft.com/en-US/evalcenter/dn434042.aspx
http://technet.microsoft.com/en-us/library/hh212961.aspx

Related

SQL Server Express and SQL Server Compact Edition

I've just built my first Umbraco site and now I want to hand it over for deployment on a web server. However, I built the site on my local machine using Web Matrix, which uses a SQL Server Compact Edition database, which is represented in a .sdf file.
I was a bit uneasy about whether this would be much use to the person I'm passing the site to (they have a number of Umbraco based sites running on this server using SQL Server) - so I installed SQL Server Express and migrated the database from Compact Edition to Express. However (again), I can't seem to find any way of exporting the full database to a file which can then by imported into a database on the web server.
A couple of points I guess - first, is the Compact Edition .sdf file actually enough for someone to take and import a database into SQL Server Standard? Failing that, how would I export the database from SQL Server Express to a file which could be used for this purpose?
Thanks in advance - this is my first foray into .net development so I'm grateful for any help!
You could just give the SQL CE database (.sdf) to the person who manages the web server. The SQL CE database can be run by default on a .NET webserver.
If, for some reason, you want to migrate it to SQL Server, you can do this through Web Matrix (http://www.microsoft.com/web/)
When you have already converted the SQL CE database to SQL Server, you can:
make a backup through the SQL Server Management Studio tool and restore the backup on the web server
or you can use the SQL Server Management Studio tool to script the database to a .sql file which can be executed on the web server
I prefer the first option.

How to use Visual Studio's built-in SQL server?

For some reason I'm not able to install a separate SQL Server instance on my pc, but I do have Visual Studio 2010 installed. I want to use the built-in SQL server bundled with VS2010, but I'm not sure how to do that. Is it possible to create a database and tables to use in my ASP.Net apps with the built-in SQL server rather than installing a separate one?
Visual Studio 2010 does not have a built-in SQL server. However, a free version of Microsoft SQL Server called 'SQL Server Express' comes with it, it's an option when installing Visual Studio.
Because this version is free for anyone to download, it has some limitations, like for example: only one CPU can be used by the express version, the maximum size of a database is 4 GB (10GB in 2008 R2), it can only use up to 1GB of RAM and it doesn't have the 'SQL Server Agent' service.
Using SQL Server Express is very similar to using a full version of SQL Server. You just have to specify the data source (the SQL server's name) and authentication details in a connection string and you're good to go. More information about how to use this is available on MSDN.
Another option is 'SQL Server Compact', which is meant mostly for web databases (for use with ASP.Net). You can install it with Microsoft's 'Web Platform Installer'. You can find more information about SQL Server Compact on MSDN.

SQL Server 2008 user instance database creation failure within an asp.net project

I'm trying to create a database within the app_data folder of an asp.net mvc project using the IDE, but i am getting a "Required Components Missing" message indicating "Connections to SQL Server files (*.mdf) requireSQL Express 2005 ....."
I am using
- Windows 7 Enterprise
- VS2008 Team System SP1
- SQL Server 2008 Developer Edition SP1
I have altered the database connection to use the default instance by setting to blank using
Tools -> Options -> Database Tools -> Data Connection : SQL Server Instance Name
I also note from the SQL Server Books Online that the user instance feature will be removed in the future, but for now it suits my effort in developing an application where a number of people are working on the project.
Has anyone managed to create a database in the same manner?
It appears Nerd Dinner has done so
The attached user-instance database in the App_Data will work only with a SQL Server Express edition - 2005 or 2008.
It does not work with a full SQL Server edition, like Web, Workgroup, Standard, Enterprise or Developer. It does not - no way - no trick to make it work - does not - period.
If you want to use that mechanism of attaching a user instance database in your App_Data folder, you must use SQL Server 2005/2008 Express.

SQL server express backend for ASP.NET web service

I come from a linux/apache/php/mysql background. For my current project, I am forced to write web services using ASP.NET. I have installed visual studio and created an ASP.NET web service project. The web service I'm creating will use a SQL database backend. I see that visual studio installed "SQL Server Express 2008." I can see that there is a service called "SQL Server (SQLEXPRESS)" that is running. My question is, how do I run queries against this database? Where's the front end? What tool do I use to create databases and tables? Is there something else I have to install?
I feel completely lost and my google-fu fails me. There are so many different SQL products from microsoft that I can't tell what is the easiest path to just having a simple database with tables I can query from my development machine. With MySQL, I would install the MySQL database, download MySQL query browser and start firing queries at it. How can I do that with Visual Studio/SQL Server Express?
You can download SQL Server Management Studio from here. This is the GUI for working with SQL Server. It will let you create databases, tables, stored procedures, etc. as well as writing queries and manually edit data in the tables.
Aside from SQL Server Management Studio, you can use the Server Explorer tab in Visual Studio (by default on the right side, next to Solution Explorer) to add a data connection. You can do most of the most common database tasks (create/query tables, create views, etc) from there.
there's a command line tool that installs with SQL Server (all versions) called SQLCMD.exe, should be in your install path.
Visual Studio also lets you create dbs, run queries, look at table structures and data (including creating and deleting them, etc), you do that by opening your Server explorer window and making a connection to your local instance (.\SQLExpress by default).
Finally, as the other person mentioned, SQL Server Management Studio Express is a free download, and well worth the time it takes to install.

How do I create my first database for .NET development?

Ok! I'm ready to embark on some .NET development for the first time.
I've recently installed Microsoft Visual Studio which included Microsoft SQL Sever 2005.
What is the prefered method for programming against a development database? I want to write an ASP.NET application that uses a database and I'm not sure how to create one. In my start menu for SQL Server 2005 all I have is:
SQL Server Configuration Manager
SQL Server Error and Usage Reports
SQL Server Surface Area Config
I don't see an intuitive program to create and design databases on that list, so how do I do it?! Will I be creating a full fledged SQL Server database or a "flat-file" fake database to program against?
Can someone please tell me what is up on creating my first MS SQL Server 2005 database?
If you've Visual Studio, just goto server explorer, Add a new database connection to your database, and start off.
Or, create a new website project in Visual studio, right click the App_Data folder->Add New Item and add a SQL Server database mdf file, which will be attached to the sql server when you run the app. You need to deploy the mdf file when doing a production release :)
You might want to watch the videos in ASP.NET website http://www.asp.net/learn/
Otherwise, consider using Microsoft SQL Server Management Studio (an express edition is also available).
You are looking for Microsoft SQL Server Management Studio Express. Its pretty easy to add a database once you get your head around it.
To be clear, the SQL Server included with Visual Studio is an express edition. However, the one thing it is lacking is the SQL Server Management Studio (Express). I'd download and install the express edition that included the management studio (note that VS 2005 and 2008 include SQL Express 2005, you can use either SQL Express 2005 or 2008 for your purposes).
You can create a new database and do everything you need to from within the VS IDE but you'll probably find the SQL Management Studio environment much more intuitive and simpler to use as a beginner.
A quick note on SQL Express - Microsoft doesn't suggest it for 'production' environments due to limitations placed on the amount of RAM that Express can see/use and a few other factors. This is one of the few cases in which I agree - if you're doing anything complex that involves large databases or dozens of users then invest in MSSQL Workgroup Edition at least, or for Enterprise projects use MSSQL Standard or Enterprise versions.

Resources